Use rust 1.74.0 in CI and move clippy lints to Cargo.toml (#4170)

* ci rust 1.74.0

* do it

* Update .woodpecker.yml

* Update Cargo.toml

* Update lint.sh

* Update lib.rs

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
dullbananas 2023-11-21 06:51:22 -07:00 committed by GitHub
parent 62357f4444
commit 30f7135f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 61 additions and 31 deletions

View file

@ -2,7 +2,7 @@
# See https://github.com/woodpecker-ci/woodpecker/issues/1677 # See https://github.com/woodpecker-ci/woodpecker/issues/1677
variables: variables:
- &rust_image "rust:1.72.1" - &rust_image "rust:1.74.0"
- &slow_check_paths - &slow_check_paths
- path: - path:
# rust source code # rust source code
@ -163,21 +163,7 @@ steps:
commands: commands:
# when adding new clippy lints, make sure to also add them in scripts/lint.sh # when adding new clippy lints, make sure to also add them in scripts/lint.sh
- rustup component add clippy - rustup component add clippy
- cargo clippy --workspace --tests --all-targets --features console -- - cargo clippy --workspace --tests --all-targets --features console -- -D warnings
-D warnings -D deprecated -D clippy::perf -D clippy::complexity
-D clippy::style -D clippy::correctness -D clippy::suspicious
-D clippy::dbg_macro -D clippy::inefficient_to_string
-D clippy::items-after-statements -D clippy::implicit_clone
-D clippy::cast_lossless -D clippy::manual_string_new
-D clippy::redundant_closure_for_method_calls
-D clippy::unused_self
-A clippy::uninlined_format_args
-D clippy::get_first
-D clippy::explicit_into_iter_loop
-D clippy::explicit_iter_loop
-D clippy::needless_collect
-D clippy::unwrap_used
-D clippy::indexing_slicing
when: *slow_check_paths when: *slow_check_paths
cargo_build: cargo_build:

View file

@ -20,6 +20,9 @@ repository.workspace = true
[lib] [lib]
doctest = false doctest = false
[lints]
workspace = true
[profile.release] [profile.release]
debug = 0 debug = 0
lto = "thin" lto = "thin"
@ -58,6 +61,28 @@ members = [
"crates/federate", "crates/federate",
] ]
[workspace.lints.clippy]
cast_lossless = "deny"
complexity = "deny"
correctness = "deny"
dbg_macro = "deny"
explicit_into_iter_loop = "deny"
explicit_iter_loop = "deny"
get_first = "deny"
implicit_clone = "deny"
indexing_slicing = "deny"
inefficient_to_string = "deny"
items-after-statements = "deny"
manual_string_new = "deny"
needless_collect = "deny"
perf = "deny"
redundant_closure_for_method_calls = "deny"
style = "deny"
suspicious = "deny"
uninlined_format_args = "allow"
unused_self = "deny"
unwrap_used = "deny"
[workspace.dependencies] [workspace.dependencies]
lemmy_api = { version = "=0.19.0-rc.5", path = "./crates/api" } lemmy_api = { version = "=0.19.0-rc.5", path = "./crates/api" }
lemmy_api_crud = { version = "=0.19.0-rc.5", path = "./crates/api_crud" } lemmy_api_crud = { version = "=0.19.0-rc.5", path = "./crates/api_crud" }

View file

@ -13,6 +13,9 @@ name = "lemmy_api"
path = "src/lib.rs" path = "src/lib.rs"
doctest = false doctest = false
[lints]
workspace = true
[dependencies] [dependencies]
lemmy_utils = { workspace = true } lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true, features = ["full"] } lemmy_db_schema = { workspace = true, features = ["full"] }

View file

@ -13,6 +13,9 @@ name = "lemmy_api_common"
path = "src/lib.rs" path = "src/lib.rs"
doctest = false doctest = false
[lints]
workspace = true
[features] [features]
full = [ full = [
"tracing", "tracing",

View file

@ -8,6 +8,9 @@ homepage.workspace = true
documentation.workspace = true documentation.workspace = true
repository.workspace = true repository.workspace = true
[lints]
workspace = true
[dependencies] [dependencies]
lemmy_utils = { workspace = true } lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true, features = ["full"] } lemmy_db_schema = { workspace = true, features = ["full"] }

View file

@ -13,6 +13,9 @@ name = "lemmy_apub"
path = "src/lib.rs" path = "src/lib.rs"
doctest = false doctest = false
[lints]
workspace = true
[dependencies] [dependencies]
lemmy_utils = { workspace = true } lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true, features = ["full"] } lemmy_db_schema = { workspace = true, features = ["full"] }

View file

@ -13,6 +13,9 @@ name = "lemmy_db_schema"
path = "src/lib.rs" path = "src/lib.rs"
doctest = false doctest = false
[lints]
workspace = true
[features] [features]
full = [ full = [
"diesel", "diesel",

View file

@ -11,6 +11,9 @@ repository.workspace = true
[lib] [lib]
doctest = false doctest = false
[lints]
workspace = true
[features] [features]
full = [ full = [
"lemmy_utils", "lemmy_utils",

View file

@ -11,6 +11,9 @@ repository.workspace = true
[lib] [lib]
doctest = false doctest = false
[lints]
workspace = true
[features] [features]
full = ["lemmy_db_schema/full", "diesel", "diesel-async", "ts-rs"] full = ["lemmy_db_schema/full", "diesel", "diesel-async", "ts-rs"]

View file

@ -11,6 +11,9 @@ repository.workspace = true
[lib] [lib]
doctest = false doctest = false
[lints]
workspace = true
[features] [features]
full = ["lemmy_db_schema/full", "diesel", "diesel-async", "ts-rs"] full = ["lemmy_db_schema/full", "diesel", "diesel-async", "ts-rs"]

View file

@ -10,6 +10,9 @@ repository.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lints]
workspace = true
[dependencies] [dependencies]
lemmy_api_common.workspace = true lemmy_api_common.workspace = true
lemmy_apub.workspace = true lemmy_apub.workspace = true

View file

@ -11,6 +11,9 @@ repository.workspace = true
[lib] [lib]
doctest = false doctest = false
[lints]
workspace = true
[dependencies] [dependencies]
lemmy_utils = { workspace = true } lemmy_utils = { workspace = true }
lemmy_db_views = { workspace = true } lemmy_db_views = { workspace = true }

View file

@ -13,6 +13,9 @@ name = "lemmy_utils"
path = "src/lib.rs" path = "src/lib.rs"
doctest = false doctest = false
[lints]
workspace = true
[features] [features]
full = ["ts-rs"] full = ["ts-rs"]

View file

@ -5,21 +5,7 @@ CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
cd $CWD/../ cd $CWD/../
cargo clippy --workspace --fix --allow-staged --allow-dirty --tests --all-targets --all-features -- \ cargo clippy --workspace --fix --allow-staged --allow-dirty --tests --all-targets --all-features -- -D warnings
-D warnings -D deprecated -D clippy::perf -D clippy::complexity \
-D clippy::style -D clippy::correctness -D clippy::suspicious \
-D clippy::dbg_macro -D clippy::inefficient_to_string \
-D clippy::items-after-statements -D clippy::implicit_clone \
-D clippy::wildcard_imports -D clippy::cast_lossless \
-D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls \
-D clippy::unused_self \
-A clippy::uninlined_format_args \
-D clippy::get_first \
-D clippy::explicit_into_iter_loop \
-D clippy::explicit_iter_loop \
-D clippy::needless_collect \
-D clippy::unwrap_used \
-D clippy::indexing_slicing
# Format rust files # Format rust files
cargo +nightly fmt cargo +nightly fmt