diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2020-12-23 13:03:19 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2021-01-23 02:18:11 +0100 |
| commit | 62337f284281637a73a8d4770315850fbf4067aa (patch) | |
| tree | f4e87d12bea2fc990ee4cd4855ce3aedd487d98b | |
| parent | 22824d21da0397d61c15a56dbb88405f4866293d (diff) | |
| download | rust-62337f284281637a73a8d4770315850fbf4067aa.tar.gz rust-62337f284281637a73a8d4770315850fbf4067aa.zip | |
remove duplicate code and other cleanup
| -rw-r--r-- | clippy_dev/Cargo.toml | 4 | ||||
| -rw-r--r-- | clippy_dev/src/crater.rs | 28 | ||||
| -rw-r--r-- | mini-crater/logs.txt | 1 |
3 files changed, 14 insertions, 19 deletions
diff --git a/clippy_dev/Cargo.toml b/clippy_dev/Cargo.toml index 6c6941837f1..e41ed77fcb9 100644 --- a/clippy_dev/Cargo.toml +++ b/clippy_dev/Cargo.toml @@ -1,8 +1,8 @@ [package] -authors = ["Philipp Hansch <dev@phansch.net>"] -edition = "2018" name = "clippy_dev" version = "0.0.1" +authors = ["Philipp Hansch <dev@phansch.net>"] +edition = "2018" [dependencies] bytecount = "0.6" diff --git a/clippy_dev/src/crater.rs b/clippy_dev/src/crater.rs index 6202acfad06..8a6ce0a8921 100644 --- a/clippy_dev/src/crater.rs +++ b/clippy_dev/src/crater.rs @@ -14,8 +14,14 @@ use std::{fs::write, path::PathBuf}; use serde::{Deserialize, Serialize}; -// crate data we stored in the toml, can have multiple versions. -// if so, one TomlKrate maps to several KrateSources +// use this to store the crates when interacting with the crates.toml file +#[derive(Debug, Serialize, Deserialize)] +struct CrateList { + crates: HashMap<String, Vec<String>>, +} + +// crate data we stored in the toml, can have multiple versions per crate +// A single TomlCrate is laster mapped to several CrateSources in that case struct TomlCrate { name: String, versions: Vec<String>, @@ -28,12 +34,6 @@ struct CrateSource { version: String, } -// use this to store the crates when interacting with the crates.toml file -#[derive(Debug, Serialize, Deserialize)] -struct CrateList { - crates: HashMap<String, Vec<String>>, -} - // represents the extracted sourcecode of a crate #[derive(Debug)] struct Crate { @@ -70,14 +70,8 @@ impl CrateSource { // unzip the tarball let ungz_tar = flate2::read::GzDecoder::new(std::fs::File::open(&krate_file_path).unwrap()); // extract the tar archive - let mut archiv = tar::Archive::new(ungz_tar); - archiv.unpack(&extract_dir).expect("Failed to extract!"); - - // unzip the tarball - let ungz_tar = flate2::read::GzDecoder::new(std::fs::File::open(&krate_file_path).unwrap()); - // extract the tar archive - let mut archiv = tar::Archive::new(ungz_tar); - archiv.unpack(&extract_dir).expect("Failed to extract!"); + let mut archive = tar::Archive::new(ungz_tar); + archive.unpack(&extract_dir).expect("Failed to extract!"); } // crate is extracted, return a new Krate object which contains the path to the extracted // sources that clippy can check @@ -132,7 +126,7 @@ impl Crate { }) .collect(); - // sort messages alphabtically to avoid noise in the logs + // sort messages alphabetically to avoid noise in the logs output.sort(); output } diff --git a/mini-crater/logs.txt b/mini-crater/logs.txt index dfa6450def7..42d978f4db4 100644 --- a/mini-crater/logs.txt +++ b/mini-crater/logs.txt @@ -1423,6 +1423,7 @@ iron-0.6.1/src/request/mod.rs:85:24: binding's name is too similar to existing b iron-0.6.1/src/request/url.rs:109:5: this method could have a `#[must_use]` attribute iron-0.6.1/src/request/url.rs:117:5: this method could have a `#[must_use]` attribute iron-0.6.1/src/request/url.rs:124:9: use of deprecated macro `try`: use the `?` operator instead +iron-0.6.1/src/request/url.rs:129:1: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true iron-0.6.1/src/request/url.rs:21:14: you should put bare URLs between `<`/`>` or make a proper Markdown link iron-0.6.1/src/request/url.rs:22:5: docs for function returning `Result` missing `# Errors` section iron-0.6.1/src/request/url.rs:31:5: docs for function returning `Result` missing `# Errors` section |
