Skip to content

Commit 0f72e3a

Browse files
committed
Move lints from CI to Cargo.toml
1 parent 9c12e49 commit 0f72e3a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/code-quality.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ jobs:
7474
run: |
7575
## `cargo clippy` lint testing
7676
unset fault
77-
CLIPPY_FLAGS="-W clippy::default_trait_access -W clippy::manual_string_new -W clippy::cognitive_complexity -W clippy::implicit_clone -W clippy::range-plus-one -W clippy::redundant-clone -W clippy::match_bool -W clippy::semicolon_if_nothing_returned"
7877
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
7978
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
8079
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
81-
S=$(cargo clippy --all-targets -pprocps -- ${CLIPPY_FLAGS} -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
80+
S=$(cargo clippy --all-targets -pprocps -- -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
8281
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,13 @@ inherits = "release"
159159
opt-level = "z"
160160
panic = "abort"
161161
strip = true
162+
163+
[workspace.lints.clippy]
164+
default_trait_access = "warn"
165+
manual_string_new = "warn"
166+
cognitive_complexity = "warn"
167+
implicit_clone = "warn"
168+
range-plus-one = "warn"
169+
redundant-clone = "warn"
170+
match_bool = "warn"
171+
semicolon_if_nothing_returned = "warn"

0 commit comments

Comments
 (0)