diff --git a/.cargo/config.toml b/.cargo/config.toml index f56b10cc..e1e769d1 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -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", +] diff --git a/contrib/ide/vscode/settings.json b/contrib/ide/vscode/settings.json index eed0a506..29583d8b 100644 --- a/contrib/ide/vscode/settings.json +++ b/contrib/ide/vscode/settings.json @@ -1,4 +1,4 @@ { "rust-analyzer.cargo.allFeatures": true, - "rust-analyzer.checkOnSave.command": "ruma-clippy" + "rust-analyzer.checkOnSave.command": "clippy", } diff --git a/xtask/src/ci.rs b/xtask/src/ci.rs index b8d77baf..1f390beb 100644 --- a/xtask/src/ci.rs +++ b/xtask/src/ci.rs @@ -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!( " @@ -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) } }