Skip to content

Commit 48fc948

Browse files
committed
clippy dev crater: address more review commetns
make serde a feature-dep save clippy version in the crater log
1 parent 94a73d7 commit 48fc948

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

clippy_dev/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ edition = "2018"
88
[dependencies]
99
bytecount = "0.6"
1010
clap = "2.33"
11-
flate2 = { version = "1.0.19" , optional = true}
11+
flate2 = { version = "1.0.19", optional = true }
1212
itertools = "0.9"
1313
opener = "0.4"
1414
regex = "1"
15-
serde = { version = "1.0", features = ["derive"]}
16-
serde_json = { version = "1.0" , optional = true}
15+
serde = { version = "1.0", features = ["derive"], optional = true }
16+
serde_json = { version = "1.0", optional = true }
1717
shell-escape = "0.1"
18-
tar = { version = "0.4.30" , optional = true}
19-
toml = { version = "0.5" , optional = true}
20-
ureq = { version = "2.0.0-rc3" , optional = true}
18+
tar = { version = "0.4.30", optional = true }
19+
toml = { version = "0.5", optional = true }
20+
ureq = { version = "2.0.0-rc3", optional = true }
2121
walkdir = "2"
2222

2323
[features]
24-
crater = ["flate2", "serde_json", "tar", "toml", "ureq"]
24+
crater = ["flate2", "serde_json", "tar", "toml", "ureq", "serde"]
2525
deny-warnings = []

clippy_dev/src/crater.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ pub fn run(clap_config: &ArgMatches) {
216216
cargo_clippy_path.display()
217217
);
218218

219+
let clippy_ver = std::process::Command::new("target/debug/cargo-clippy")
220+
.arg("--version")
221+
.output()
222+
.map(|o| String::from_utf8_lossy(&o.stdout).into_owned())
223+
.expect("could not get clippy version!");
224+
219225
// download and extract the crates, then run clippy on them and collect clippys warnings
220226
// flatten into one big list of warnings
221227

@@ -274,6 +280,7 @@ pub fn run(clap_config: &ArgMatches) {
274280
all_msgs.push(stats_formatted);
275281

276282
// save the text into mini-crater/logs.txt
277-
let text = all_msgs.join("");
283+
let mut text = clippy_ver; // clippy version number on top
284+
text.push_str(&format!("\n{}", all_msgs.join("")));
278285
write("mini-crater/logs.txt", text).unwrap();
279286
}

clippy_dev/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
6565
);
6666

6767
let app = App::new("Clippy developer tooling")
68-
.subcommand(
68+
.subcommand(
6969
SubCommand::with_name("bless")
7070
.about("bless the test output changes")
7171
.arg(

mini-crater/logs.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
clippy 0.0.212 (0d8a27a6f 2020-12-28)
2+
13
cargo/0.49.0//home/matthias/.rustup/toolchains/nightly-2020-12-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/macros/mod.rs:393:34 clippy::match_same_arms "this `match` has identical arm bodies"
24
cargo/0.49.0/build.rs:1:null clippy::cargo_common_metadata "package `cargo` is missing `package.categories` metadata"
35
cargo/0.49.0/build.rs:1:null clippy::cargo_common_metadata "package `cargo` is missing `package.keywords` metadata"
@@ -107,6 +109,7 @@ cargo/0.49.0/src/cargo/core/compiler/build_context/target_info.rs:96:31 clippy::
107109
cargo/0.49.0/src/cargo/core/compiler/build_context/target_info.rs:98:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
108110
cargo/0.49.0/src/cargo/core/compiler/build_plan.rs:4:9 clippy::doc_markdown "you should put `BuildPlan` between ticks in the documentation"
109111
cargo/0.49.0/src/cargo/core/compiler/build_plan.rs:5:66 clippy::doc_markdown "you should put `BuildPlan` between ticks in the documentation"
112+
cargo/0.49.0/src/cargo/core/compiler/build_plan.rs:66:40 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do."
110113
cargo/0.49.0/src/cargo/core/compiler/compilation.rs:150:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
111114
cargo/0.49.0/src/cargo/core/compiler/compilation.rs:169:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
112115
cargo/0.49.0/src/cargo/core/compiler/compilation.rs:185:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
@@ -237,6 +240,8 @@ cargo/0.49.0/src/cargo/core/compiler/mod.rs:364:5 clippy::items_after_statements
237240
cargo/0.49.0/src/cargo/core/compiler/mod.rs:364:5 clippy::unnecessary_wraps "this function's return value is unnecessarily wrapped by `Result`"
238241
cargo/0.49.0/src/cargo/core/compiler/mod.rs:392:45 clippy::redundant_closure_for_method_calls "redundant closure found"
239242
cargo/0.49.0/src/cargo/core/compiler/mod.rs:415:23 clippy::single_match_else "you seem to be trying to use match for destructuring a single pattern. Consider using `if let`"
243+
cargo/0.49.0/src/cargo/core/compiler/mod.rs:464:18 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do."
244+
cargo/0.49.0/src/cargo/core/compiler/mod.rs:488:61 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do."
240245
cargo/0.49.0/src/cargo/core/compiler/mod.rs:667:15 clippy::similar_names "binding's name is too similar to existing binding"
241246
cargo/0.49.0/src/cargo/core/compiler/mod.rs:693:1 clippy::unnecessary_wraps "this function's return value is unnecessarily wrapped by `Result`"
242247
cargo/0.49.0/src/cargo/core/compiler/mod.rs:725:42 clippy::match_same_arms "this `match` has identical arm bodies"
@@ -3059,9 +3064,9 @@ ripgrep/12.1.1/crates/core/search.rs:533:5 clippy::cast_precision_loss "casting
30593064
ripgrep/12.1.1/crates/core/subject.rs:20:1 clippy::module_name_repetitions "item name starts with its containing module's name"
30603065
ripgrep/12.1.1/crates/core/subject.rs:4:1 clippy::single_component_path_imports "this import is redundant"
30613066
syn/1.0.54/build.rs:1:null clippy::cargo_common_metadata "package `syn` is missing `package.keywords` metadata"
3062-
syn/1.0.54/build.rs:1:null clippy::multiple_crate_versions "could not read cargo metadata: failed to run `cargo metadata`: Blocking waiting for file lock on package cache\n Blocking waiting for file lock on package cache\n Blocking waiting for file lock on package cache\n Downloading crates ...\n Downloaded ref-cast v1.0.5\n Downloaded ref-cast-impl v1.0.5\n Downloaded syn-test-suite v0.0.0\nerror: failed to verify the checksum of `syn-test-suite v0.0.0`"
3067+
syn/1.0.54/build.rs:1:null clippy::multiple_crate_versions "could not read cargo metadata: failed to run `cargo metadata`: Downloading crates ...\n Downloaded dtoa v0.4.7\n Downloaded anyhow v1.0.37\n Downloaded syn-test-suite v0.0.0\nerror: failed to verify the checksum of `syn-test-suite v0.0.0`"
30633068
syn/1.0.54/src/lib.rs:1:null clippy::cargo_common_metadata "package `syn` is missing `package.keywords` metadata"
3064-
syn/1.0.54/src/lib.rs:1:null clippy::multiple_crate_versions "could not read cargo metadata: failed to run `cargo metadata`: Downloading crates ...\n Downloaded openssl-sys v0.9.60\n Downloaded syn-test-suite v0.0.0\nerror: failed to verify the checksum of `syn-test-suite v0.0.0`"
3069+
syn/1.0.54/src/lib.rs:1:null clippy::multiple_crate_versions "could not read cargo metadata: failed to run `cargo metadata`: Downloading crates ...\n Downloaded syn-test-suite v0.0.0\nerror: failed to verify the checksum of `syn-test-suite v0.0.0`"
30653070
syn/1.0.54/src/lit.rs:1397:40 clippy::redundant_else "redundant else block"
30663071
syn/1.0.54/src/lit.rs:1405:28 clippy::redundant_else "redundant else block"
30673072
syn/1.0.54/src/lit.rs:1485:32 clippy::redundant_else "redundant else block"
@@ -3293,6 +3298,7 @@ clippy::write_with_newline 2
32933298
clippy::filter_map_next 3
32943299
clippy::fn_params_excessive_bools 3
32953300
clippy::mut_mut 3
3301+
clippy::ptr_arg 3
32963302
clippy::zero_ptr 3
32973303
clippy::if_same_then_else 4
32983304
clippy::let_underscore_drop 4

0 commit comments

Comments
 (0)