Skip to content

Commit ebc764e

Browse files
committed
Auto merge of #5884 - dwijnand:some-clippings, r=alexcrichton
Resolve some clippy lint warnings None
2 parents 24888de + e0b9e43 commit ebc764e

File tree

9 files changed

+27
-37
lines changed

9 files changed

+27
-37
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,8 @@ fn json_stderr(line: &str, package_id: &PackageId, target: &Target) -> CargoResu
10101010
.map_err(|_| internal(&format!("compiler produced invalid json: `{}`", line)))?;
10111011

10121012
machine_message::emit(&machine_message::FromCompiler {
1013-
package_id: package_id,
1014-
target: target,
1013+
package_id,
1014+
target,
10151015
message: compiler_message,
10161016
});
10171017
} else {

src/cargo/ops/fix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ fn rustfix_and_fix(fixes: &mut FixedCrate, rustc: &Path, filename: &Path, args:
328328
filename,
329329
output.status.code()
330330
);
331-
return Ok(Default::default());
331+
return Ok(());
332332
}
333333

334334
let fix_mode = env::var_os("__CARGO_FIX_YOLO")

src/cargo/util/lev_distance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn test_lev_distance() {
3838
use std::char::{from_u32, MAX};
3939
// Test bytelength agnosticity
4040
for c in (0u32..MAX as u32)
41-
.filter_map(|i| from_u32(i))
41+
.filter_map(from_u32)
4242
.map(|i| i.to_string())
4343
{
4444
assert_eq!(lev_distance(&c, &c), 0);

tests/testsuite/build_script.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::env;
22
use std::fs::{self, File};
33
use std::io::prelude::*;
4-
use std::path::PathBuf;
54
use std::io;
65
use std::thread;
76
use std::time::Duration;
@@ -3555,8 +3554,7 @@ fn rename_with_link_search_path() {
35553554
// the `p` project. On OSX the `libfoo.dylib` artifact references the
35563555
// original path in `p` so we want to make sure that it can't find it (hence
35573556
// the deletion).
3558-
let root = PathBuf::from(p.root());
3559-
let root = root.join("target").join("debug").join("deps");
3557+
let root = p.root().join("target").join("debug").join("deps");
35603558
let file = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
35613559
let src = root.join(&file);
35623560

tests/testsuite/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,10 @@ i64max = 9223372036854775807
651651
("CARGO_EI64MAX", "9223372036854775807"),
652652
]);
653653

654-
assert_eq!(config.get::<u64>("i64max").unwrap(), 9223372036854775807);
655-
assert_eq!(config.get::<i64>("i64max").unwrap(), 9223372036854775807);
656-
assert_eq!(config.get::<u64>("ei64max").unwrap(), 9223372036854775807);
657-
assert_eq!(config.get::<i64>("ei64max").unwrap(), 9223372036854775807);
654+
assert_eq!(config.get::<u64>("i64max").unwrap(), 9_223_372_036_854_775_807);
655+
assert_eq!(config.get::<i64>("i64max").unwrap(), 9_223_372_036_854_775_807);
656+
assert_eq!(config.get::<u64>("ei64max").unwrap(), 9_223_372_036_854_775_807);
657+
assert_eq!(config.get::<i64>("ei64max").unwrap(), 9_223_372_036_854_775_807);
658658

659659
assert_error(
660660
config.get::<u32>("nneg").unwrap_err(),

tests/testsuite/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ fn doc_private_items() {
13591359
assert_that(&foo.root().join("target/doc/foo/private/index.html"), existing_file());
13601360
}
13611361

1362-
const BAD_INTRA_LINK_LIB: &'static str = r#"
1362+
const BAD_INTRA_LINK_LIB: &str = r#"
13631363
#![deny(intra_doc_link_resolution_failure)]
13641364
13651365
/// [bad_link]

tests/testsuite/git.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,24 +218,22 @@ fn cargo_compile_offline_with_cached_git_dep() {
218218
execs().with_stdout("hello from cached git repo rev2\n"),
219219
);
220220

221-
drop(
222-
File::create(&p.root().join("Cargo.toml"))
223-
.unwrap()
224-
.write_all(&format!(
225-
r#"
226-
[project]
227-
name = "foo"
228-
version = "0.5.0"
221+
File::create(&p.root().join("Cargo.toml"))
222+
.unwrap()
223+
.write_all(&format!(
224+
r#"
225+
[project]
226+
name = "foo"
227+
version = "0.5.0"
229228
230-
[dependencies.dep1]
231-
git = '{}'
232-
rev = "{}"
229+
[dependencies.dep1]
230+
git = '{}'
231+
rev = "{}"
233232
"#,
234-
git_project.url(),
235-
rev1
236-
).as_bytes())
237-
.unwrap(),
238-
);
233+
git_project.url(),
234+
rev1
235+
).as_bytes())
236+
.unwrap();
239237

240238
let _out = p
241239
.cargo("build")

tests/testsuite/support/git.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ pub fn commit(repo: &git2::Repository) -> git2::Oid {
137137
let tree_id = t!(t!(repo.index()).write_tree());
138138
let sig = t!(repo.signature());
139139
let mut parents = Vec::new();
140-
match repo.head().ok().map(|h| h.target().unwrap()) {
141-
Some(parent) => parents.push(t!(repo.find_commit(parent))),
142-
None => {}
140+
if let Some(parent) = repo.head().ok().map(|h| h.target().unwrap()) {
141+
parents.push(t!(repo.find_commit(parent)))
143142
}
144143
let parents = parents.iter().collect::<Vec<_>>();
145144
t!(repo.commit(

tests/testsuite/support/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,7 @@ impl ProjectBuilder {
261261
symlink.mk();
262262
}
263263

264-
let ProjectBuilder {
265-
root,
266-
files: _,
267-
symlinks: _,
268-
..
269-
} = self;
264+
let ProjectBuilder { root, .. } = self;
270265
root
271266
}
272267

0 commit comments

Comments
 (0)