From 1777d180ec242b29d830be6a6a3373cf1170d8d7 Mon Sep 17 00:00:00 2001 From: Alex Butler Date: Tue, 26 Feb 2019 09:19:54 +0000 Subject: [PATCH] trust-check rustfmt & clippy mods --- aur | 2 +- trust-check/Cargo.lock | 28 ++++++++++++++-------------- trust-check/src/main.rs | 23 ++++++++--------------- 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/aur b/aur index cd8c659..a01f50d 160000 --- a/aur +++ b/aur @@ -1 +1 @@ -Subproject commit cd8c65964126b3a422072f347d78a5cb53bb2281 +Subproject commit a01f50d83496604d460b74910d4203cf34e091ee diff --git a/trust-check/Cargo.lock b/trust-check/Cargo.lock index d53e2dd..e0f8330 100644 --- a/trust-check/Cargo.lock +++ b/trust-check/Cargo.lock @@ -17,10 +17,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", - "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.41 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -31,9 +31,9 @@ version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.41 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -60,7 +60,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.48" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -69,7 +69,7 @@ version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -81,11 +81,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.40" +version = "0.9.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -102,7 +102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "schannel" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -115,7 +115,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -170,13 +170,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad0485404155f45cce53a40d4b2d6ac356418300daed05273d9e26f91c390be" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" +"checksum libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "413f3dfc802c5dc91dc570b05125b6cda9855edfaa9825c9849807876376e70e" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" +"checksum openssl-sys 0.9.41 (registry+https://github.com/rust-lang/crates.io-index)" = "e4c77cdd67d31759b22aa72cfda3c65c12348f9e6c5420946b403c022fd0311a" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" -"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" +"checksum schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f6abf258d99c3c1c5c2131d99d064e94b7b3dd5f416483057f308fea253339" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/trust-check/src/main.rs b/trust-check/src/main.rs index 63fc0d2..5496548 100644 --- a/trust-check/src/main.rs +++ b/trust-check/src/main.rs @@ -6,12 +6,10 @@ //! for each mistrusted package. //! //! If package is not found in the AUR will output PACKAGE_NAME::not-in-aur -use std::alloc::System; -use std::borrow::Cow; -use std::collections::HashSet; -use std::error::Error; -use std::path::Path; -use std::{env, fs, str}; +use std::{ + alloc::System, borrow::Cow, collections::HashSet, env, error::Error, ffi::OsStr, fs, + path::Path, str, +}; #[global_allocator] static GLOBAL: System = System; @@ -38,12 +36,7 @@ fn main() -> Res<()> { } let trust_everyone = !Path::new(LOCAL_TRUST_PATH).is_file(); - - let trusted = if trust_everyone { - HashSet::new() - } else { - local_trusted_users()? - }; + let trusted = if trust_everyone { HashSet::new() } else { local_trusted_users()? }; let (pkg_maintainers, not_in_aur) = package_maintainers(&packages)?; @@ -68,7 +61,7 @@ fn translate_full_package(arg: String) -> Result { if arg.contains(".pkg.") { let archive_name = Path::new(&arg) .file_name() - .and_then(|f| f.to_str()) + .and_then(OsStr::to_str) .ok_or_else(|| format!("Can't handle arg `{}`", arg))?; let mut name_bits: Vec<_> = archive_name.split('-').rev().skip(3).collect(); name_bits.reverse(); @@ -100,7 +93,7 @@ fn package_maintainers>( for pkg in packages .iter() .flat_map(|p| p.as_ref().split('\n')) - .map(|p| p.trim()) + .map(str::trim) .filter(|p| !p.is_empty()) { url = url + "&arg[]=" + &uri_encode_pkg(valid_arch_package_name(pkg)?); @@ -125,7 +118,7 @@ fn package_maintainers>( let not_in_aur: Vec<_> = { let in_aur: HashSet<_> = json["results"] .members() - .filter_map(|info| info["Name"].as_str().map(|s| s.to_lowercase())) + .filter_map(|info| info["Name"].as_str().map(str::to_lowercase)) .collect(); packages