Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions net-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::arithmetic_side_effects)]

//! The `net_utils` module assists with networking
mod ip_echo_client;
mod ip_echo_server;
Expand Down
7 changes: 6 additions & 1 deletion scripts/cargo-clippy-nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ source "$here/../ci/rust-version.sh" nightly
# ref: https://github.com/rust-lang/rust/issues/66287
"$here/cargo-for-all-lock-files.sh" -- \
"+${rust_nightly}" clippy \
--workspace --all-targets --features dummy-for-ci-check,frozen-abi
--workspace --all-targets --features dummy-for-ci-check,frozen-abi -- \
--deny=warnings \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we had these in clippy.toml, did they apply to all workspaces? agreed that putting them in Cargo.toml is pretty unmaintainable so long as we have multiple workspaces in the monorepo

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping them in sync is a matter of a grep checking for relevant section in cargo.toml, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I don't miss anything, clippy.toml couldn't do that. for allowing/denying lints, we can only do either

  • embedded in code
  • cli flags
  • Cargo.toml

ref: https://doc.rust-lang.org/clippy/configuration.html#allowingdenying-lints

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this is correct, we either do CLI flags (which is not ideal as it prevents simply running cargo +nightly clippy during development as you have to call the script which will set all the CLAs for you) or we make sure crates inherit main config correctly. I'd prefer crates inheriting correctly from workspace.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files=`find . -name "Cargo.toml" `
for file in $files; do
    if ! grep -q "^\[lints\]" "$file"; then
      echo "Lints missing in $file"
      #echo -e "\n[lints]\nworkspace = true" >> "$file"
      #echo "Added [lints] to $file"
      # maybe call cargo sort here?
    else
      echo "$file already has [lints]"
    fi
  done

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to rely on Cargo.toml if we don’t have CI to ensure the rules are consistent in this repo and to enforce that newly added crates include lints.workspace = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plug that shell script above into CI?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m happy to do improvements in separate PRs. for this PR, I would like to focus on reverting the lint checks back to how they were before.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping them in sync is a matter of a grep checking for relevant section in cargo.toml, no?

we want fewer, not more, rube goldberg machines

--deny=clippy::default_trait_access \
--deny=clippy::arithmetic_side_effects \
--deny=clippy::manual_let_else \
--deny=clippy::used_underscore_binding
Loading