Skip to content

Commit

Permalink
Enable lints through rustflags instead of alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Oct 19, 2021
1 parent 21487aa commit 1aca228
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 32 deletions.
57 changes: 29 additions & 28 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
[alias]
xtask = "run --package xtask --"
ruma-clippy = """\
clippy --workspace --all-targets --features=full,compat,unstable-pre-spec -- \
-W rust_2018_idioms \
-W semicolon_in_expressions_from_macros \
-W unused_import_braces \
-W unused_qualifications \
-W clippy::branches_sharing_code \
-W clippy::cloned_instead_of_copied \
-W clippy::dbg_macro \
-W clippy::disallowed_type \
-W clippy::empty_line_after_outer_attr \
-W clippy::exhaustive_enums \
-W clippy::exhaustive_structs \
-W clippy::inefficient_to_string \
-W clippy::macro_use_imports \
-W clippy::map_flatten \
-W clippy::missing_enforced_import_renames \
-W clippy::mod_module_files \
-W clippy::mut_mut \
-W clippy::needless_borrow \
-A clippy::new_without_default \
-W clippy::nonstandard_macro_braces \
-W clippy::str_to_string \
-W clippy::todo \
-W clippy::unreadable_literal \
-W clippy::unseparated_literal_suffix \
-W clippy::wildcard_imports \
"""

[doc.extern-map.registries]
crates-io = "https://docs.rs/"

[target.'cfg(all())']
rustflags = [
"-Wrust_2018_idioms",
"-Wsemicolon_in_expressions_from_macros",
"-Wunused_import_braces",
"-Wunused_qualifications",
"-Wclippy::branches_sharing_code",
"-Wclippy::cloned_instead_of_copied",
"-Wclippy::dbg_macro",
"-Wclippy::disallowed_type",
"-Wclippy::empty_line_after_outer_attr",
"-Wclippy::exhaustive_enums",
"-Wclippy::exhaustive_structs",
"-Wclippy::inefficient_to_string",
"-Wclippy::macro_use_imports",
"-Wclippy::map_flatten",
"-Wclippy::missing_enforced_import_renames",
"-Wclippy::mod_module_files",
"-Wclippy::mut_mut",
"-Wclippy::needless_borrow",
"-Aclippy::new_without_default",
"-Wclippy::nonstandard_macro_braces",
"-Wclippy::str_to_string",
"-Wclippy::todo",
"-Wclippy::unreadable_literal",
"-Wclippy::unseparated_literal_suffix",
"-Wclippy::wildcard_imports",
]
2 changes: 1 addition & 1 deletion contrib/ide/vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rust-analyzer.cargo.allFeatures": true,
"rust-analyzer.checkOnSave.command": "ruma-clippy"
"rust-analyzer.checkOnSave.command": "clippy",
}
20 changes: 17 additions & 3 deletions xtask/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,22 @@ impl CiTask {
// Check `ruma` crate with `full` feature (sometimes things only compile with an unstable
// flag)
let check_full_res = cmd!("rustup run nightly cargo check -p ruma --features full").run();
// Check everything with (almost) all features with clippy
let clippy_res = cmd!("rustup run nightly cargo ruma-clippy -D warnings").run();
// Check everything with default features with clippy
let clippy_default_res = cmd!(
"
rustup run nightly cargo clippy
--workspace --all-targets --features=full -- -D warnings
"
)
.run();
// Check everything with almost all features with clippy
let clippy_all_res = cmd!(
"
rustup run nightly cargo clippy
--workspace --all-targets --features=full,compat,unstable-pre-spec -- -D warnings
"
)
.run();
// Check dependencies being sorted
let sort_res = cmd!(
"
Expand All @@ -93,6 +107,6 @@ impl CiTask {
)
.run();

fmt_res.and(check_full_res).and(clippy_res).and(sort_res)
fmt_res.and(check_full_res).and(clippy_default_res).and(clippy_all_res).and(sort_res)
}
}

0 comments on commit 1aca228

Please sign in to comment.