提交 62337f28 编写于 作者: M Matthias Krüger

remove duplicate code and other cleanup

上级 22824d21
[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"
......
......@@ -14,8 +14,14 @@
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 @@ fn download_and_extract(&self) -> Crate {
// 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 @@ fn run_clippy_lints(&self, cargo_clippy_path: &PathBuf) -> Vec<String> {
})
.collect();
// sort messages alphabtically to avoid noise in the logs
// sort messages alphabetically to avoid noise in the logs
output.sort();
output
}
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册