From 3d8620babf20900dcd95f522a945e79a85449268 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:40:08 +0100 Subject: [PATCH 01/10] Resolve 2 redundant_field_names lint warnings --- src/cargo/core/compiler/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index e8cab8bc47d..d417ebb417d 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -1010,8 +1010,8 @@ fn json_stderr(line: &str, package_id: &PackageId, target: &Target) -> CargoResu .map_err(|_| internal(&format!("compiler produced invalid json: `{}`", line)))?; machine_message::emit(&machine_message::FromCompiler { - package_id: package_id, - target: target, + package_id, + target, message: compiler_message, }); } else { From 6dd73398a37374cf3b5f2ed3c39d2aa9346b01d6 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:40:24 +0100 Subject: [PATCH 02/10] Resolve a unit_arg lint warning --- src/cargo/ops/fix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/ops/fix.rs b/src/cargo/ops/fix.rs index 7bc2cd405b8..275a471bd17 100644 --- a/src/cargo/ops/fix.rs +++ b/src/cargo/ops/fix.rs @@ -328,7 +328,7 @@ fn rustfix_and_fix(fixes: &mut FixedCrate, rustc: &Path, filename: &Path, args: filename, output.status.code() ); - return Ok(Default::default()); + return Ok(()); } let fix_mode = env::var_os("__CARGO_FIX_YOLO") From b98fd0e8bd9a3bcc4ad59d9f58659e7bc540cbef Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:40:40 +0100 Subject: [PATCH 03/10] Resolve a redundant_closure lint warning --- src/cargo/util/lev_distance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/util/lev_distance.rs b/src/cargo/util/lev_distance.rs index 1d1eae05a80..c4a7e9856bf 100644 --- a/src/cargo/util/lev_distance.rs +++ b/src/cargo/util/lev_distance.rs @@ -38,7 +38,7 @@ fn test_lev_distance() { use std::char::{from_u32, MAX}; // Test bytelength agnosticity for c in (0u32..MAX as u32) - .filter_map(|i| from_u32(i)) + .filter_map(from_u32) .map(|i| i.to_string()) { assert_eq!(lev_distance(&c, &c), 0); From d0624dfcd7a260303b8c3d02660071e574cb7bec Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:41:37 +0100 Subject: [PATCH 04/10] Resolve 2 unneeded_field_pattern lint warnings --- tests/testsuite/support/mod.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/testsuite/support/mod.rs b/tests/testsuite/support/mod.rs index 7d64d4a1f5d..75579cd2de1 100644 --- a/tests/testsuite/support/mod.rs +++ b/tests/testsuite/support/mod.rs @@ -261,12 +261,7 @@ impl ProjectBuilder { symlink.mk(); } - let ProjectBuilder { - root, - files: _, - symlinks: _, - .. - } = self; + let ProjectBuilder { root, .. } = self; root } From c9b59deb3a9900dfd74c4b18a9eb7b74419a4099 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:41:03 +0100 Subject: [PATCH 05/10] Resolve 4 unreadable_literal lint warnings --- tests/testsuite/config.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index b712fdaaccc..68008efe846 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -651,10 +651,10 @@ i64max = 9223372036854775807 ("CARGO_EI64MAX", "9223372036854775807"), ]); - assert_eq!(config.get::("i64max").unwrap(), 9223372036854775807); - assert_eq!(config.get::("i64max").unwrap(), 9223372036854775807); - assert_eq!(config.get::("ei64max").unwrap(), 9223372036854775807); - assert_eq!(config.get::("ei64max").unwrap(), 9223372036854775807); + assert_eq!(config.get::("i64max").unwrap(), 9_223_372_036_854_775_807); + assert_eq!(config.get::("i64max").unwrap(), 9_223_372_036_854_775_807); + assert_eq!(config.get::("ei64max").unwrap(), 9_223_372_036_854_775_807); + assert_eq!(config.get::("ei64max").unwrap(), 9_223_372_036_854_775_807); assert_error( config.get::("nneg").unwrap_err(), From 3fdec5a2c6758a452513f416abd0c927415ed5b4 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:41:10 +0100 Subject: [PATCH 06/10] Resolve a const_static_lifetime lint warning --- tests/testsuite/doc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 4789962f39b..68346e2ce13 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -1359,7 +1359,7 @@ fn doc_private_items() { assert_that(&foo.root().join("target/doc/foo/private/index.html"), existing_file()); } -const BAD_INTRA_LINK_LIB: &'static str = r#" +const BAD_INTRA_LINK_LIB: &str = r#" #![deny(intra_doc_link_resolution_failure)] /// [bad_link] From 972b312a08e8ef0e39ea786d20db5f30cae50737 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:41:27 +0100 Subject: [PATCH 07/10] Resolve a single_match lint warning --- tests/testsuite/support/git.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/testsuite/support/git.rs b/tests/testsuite/support/git.rs index a35f65f3ad9..fb0f1d8231d 100644 --- a/tests/testsuite/support/git.rs +++ b/tests/testsuite/support/git.rs @@ -137,9 +137,8 @@ pub fn commit(repo: &git2::Repository) -> git2::Oid { let tree_id = t!(t!(repo.index()).write_tree()); let sig = t!(repo.signature()); let mut parents = Vec::new(); - match repo.head().ok().map(|h| h.target().unwrap()) { - Some(parent) => parents.push(t!(repo.find_commit(parent))), - None => {} + if let Some(parent) = repo.head().ok().map(|h| h.target().unwrap()) { + parents.push(t!(repo.find_commit(parent))) } let parents = parents.iter().collect::>(); t!(repo.commit( From 11922d099b0e8b5d5af1cd24aaaf80ce6100cb6d Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:40:53 +0100 Subject: [PATCH 08/10] Resolve a identity_conversion lint warning --- tests/testsuite/build_script.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 0d98e389379..3f436870490 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -1,7 +1,6 @@ use std::env; use std::fs::{self, File}; use std::io::prelude::*; -use std::path::PathBuf; use std::io; use std::thread; use std::time::Duration; @@ -3555,7 +3554,7 @@ fn rename_with_link_search_path() { // the `p` project. On OSX the `libfoo.dylib` artifact references the // original path in `p` so we want to make sure that it can't find it (hence // the deletion). - let root = PathBuf::from(p.root()); + let root = p.root(); let root = root.join("target").join("debug").join("deps"); let file = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX); let src = root.join(&file); From 0c89a748d14194cc5567b327ede34529e4986dd3 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 10:41:19 +0100 Subject: [PATCH 09/10] Resolve a drop_copy lint warning --- tests/testsuite/git.rs | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index 59d8099820d..f6a9f0cbd22 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -218,24 +218,22 @@ fn cargo_compile_offline_with_cached_git_dep() { execs().with_stdout("hello from cached git repo rev2\n"), ); - drop( - File::create(&p.root().join("Cargo.toml")) - .unwrap() - .write_all(&format!( - r#" - [project] - name = "foo" - version = "0.5.0" + File::create(&p.root().join("Cargo.toml")) + .unwrap() + .write_all(&format!( + r#" + [project] + name = "foo" + version = "0.5.0" - [dependencies.dep1] - git = '{}' - rev = "{}" + [dependencies.dep1] + git = '{}' + rev = "{}" "#, - git_project.url(), - rev1 - ).as_bytes()) - .unwrap(), - ); + git_project.url(), + rev1 + ).as_bytes()) + .unwrap(); let _out = p .cargo("build") From e0b9e437712b1d8b1dff7148b386437b618e5f15 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Aug 2018 11:48:50 +0100 Subject: [PATCH 10/10] Collapse let bindings --- tests/testsuite/build_script.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 3f436870490..c399c98d9aa 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -3554,8 +3554,7 @@ fn rename_with_link_search_path() { // the `p` project. On OSX the `libfoo.dylib` artifact references the // original path in `p` so we want to make sure that it can't find it (hence // the deletion). - let root = p.root(); - let root = root.join("target").join("debug").join("deps"); + let root = p.root().join("target").join("debug").join("deps"); let file = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX); let src = root.join(&file);