remove duplicate code and other cleanup
This commit is contained in:
parent
22824d21da
commit
62337f2842
3 changed files with 14 additions and 19 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue