check line width not needed (#9820)

* check line width not needed

(cargo fmt checks this)

* Fixing test to work in release mode.
This commit is contained in:
Squirrel
2021-09-21 12:37:57 +01:00
committed by GitHub
parent f6ab53f3c3
commit 29816054f6
3 changed files with 7 additions and 67 deletions
-10
View File
@@ -269,16 +269,6 @@ check-signed-tag:
script:
- ./.maintain/gitlab/check_signed.sh
check-line-width:
stage: check
image: paritytech/tools:latest
<<: *kubernetes-env
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
script:
- ./.maintain/gitlab/check_line_width.sh
allow_failure: true
test-dependency-rules:
stage: check
image: paritytech/tools:latest
@@ -1,55 +0,0 @@
#!/bin/sh
#
# check if line width of rust source files is not beyond x characters
#
set -e
set -o pipefail
BASE_ORIGIN="origin"
BASE_BRANCH_NAME="master"
LINE_WIDTH="120"
GOOD_LINE_WIDTH="100"
BASE_BRANCH="${BASE_ORIGIN}/${BASE_BRANCH_NAME}"
git fetch ${BASE_ORIGIN} ${BASE_BRANCH_NAME} --depth 100
BASE_HASH=$(git merge-base ${BASE_BRANCH} HEAD)
git diff --name-only ${BASE_HASH} -- \*.rs | ( while read file
do
if [ ! -f ${file} ];
then
echo "Skipping removed file."
elif git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $LINE_WIDTH + 1 ))\}"
then
if [ -z "${FAIL}" ]
then
echo "| error!"
echo "| Lines must not be longer than ${LINE_WIDTH} characters."
echo "| "
echo "| see more https://github.com/paritytech/substrate/blob/master/docs/STYLE_GUIDE.md"
echo "|"
FAIL="true"
fi
echo "| file: ${file}"
git diff ${BASE_HASH} -- ${file} \
| grep -n "^+.\{$(( $LINE_WIDTH + 1))\}"
echo "|"
else
if git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}"
then
if [ -z "${FAIL}" ]
then
echo "| warning!"
echo "| Lines should be longer than ${GOOD_LINE_WIDTH} characters only in exceptional circumstances!"
echo "| "
echo "| see more https://github.com/paritytech/substrate/blob/master/docs/STYLE_GUIDE.md"
echo "|"
fi
echo "| file: ${file}"
git diff ${BASE_HASH} -- ${file} | grep -n "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}"
echo "|"
fi
fi
done
test -z "${FAIL}"
)
+7 -2
View File
@@ -537,7 +537,10 @@ mod bags {
// Panics in case of duplicate tail insert (which would result in an infinite loop).
#[test]
#[should_panic = "system logic error: inserting a node who has the id of tail"]
#[cfg_attr(
debug_assertions,
should_panic = "system logic error: inserting a node who has the id of tail"
)]
fn insert_node_duplicate_tail_panics_with_debug_assert() {
ExtBuilder::default().build_and_execute(|| {
let node = |id, prev, next, bag_upper| Node::<Runtime> { id, prev, next, bag_upper };
@@ -548,7 +551,9 @@ mod bags {
// when inserting a duplicate id that is already the tail
assert_eq!(bag_1000.tail, Some(4));
bag_1000.insert_node_unchecked(node(4, None, None, bag_1000.bag_upper)); // panics
assert_eq!(bag_1000.iter().count(), 3);
bag_1000.insert_node_unchecked(node(4, None, None, bag_1000.bag_upper)); // panics in debug
assert_eq!(bag_1000.iter().count(), 3); // in release we expect it to silently ignore the request.
});
}