Skip to content

Commit ef4176a

Browse files
authored
Merge pull request rust-lang#3205 from matthiaskrgr/clippy
fix a few clippy warnings
2 parents fa9fd5c + 3aa1533 commit ef4176a

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Diff for: src/config/file_lines.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn normalize_ranges(ranges: &mut HashMap<FileName, Vec<Range>>) {
167167
ranges.sort();
168168
let mut result = vec![];
169169
{
170-
let mut iter = ranges.into_iter().peekable();
170+
let mut iter = ranges.iter_mut().peekable();
171171
while let Some(next) = iter.next() {
172172
let mut next = *next;
173173
while let Some(&&mut peek) = iter.peek() {

Diff for: src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ fn rewrite_struct_lit<'a>(
15841584
)?
15851585
} else {
15861586
let field_iter = fields
1587-
.into_iter()
1587+
.iter()
15881588
.map(StructLitField::Regular)
15891589
.chain(base.into_iter().map(StructLitField::Base));
15901590

Diff for: src/patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn rewrite_tuple_pat(
313313
context: &RewriteContext,
314314
shape: Shape,
315315
) -> Option<String> {
316-
let mut pat_vec: Vec<_> = pats.into_iter().map(|x| TuplePatField::Pat(x)).collect();
316+
let mut pat_vec: Vec<_> = pats.iter().map(|x| TuplePatField::Pat(x)).collect();
317317

318318
if let Some(pos) = dotdot_pos {
319319
let prev = if pos == 0 {

Diff for: src/test/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn write_message(msg: &str) {
114114
fn system_tests() {
115115
// Get all files in the tests/source directory.
116116
let files = get_test_files(Path::new("tests/source"), true);
117-
let (_reports, count, fails) = check_files(files, None);
117+
let (_reports, count, fails) = check_files(files, &None);
118118

119119
// Display results.
120120
println!("Ran {} system tests.", count);
@@ -126,7 +126,7 @@ fn system_tests() {
126126
#[test]
127127
fn coverage_tests() {
128128
let files = get_test_files(Path::new("tests/coverage/source"), true);
129-
let (_reports, count, fails) = check_files(files, None);
129+
let (_reports, count, fails) = check_files(files, &None);
130130

131131
println!("Ran {} tests in coverage mode.", count);
132132
assert_eq!(fails, 0, "{} tests failed", fails);
@@ -230,7 +230,7 @@ fn idempotence_tests() {
230230
}
231231
// Get all files in the tests/target directory.
232232
let files = get_test_files(Path::new("tests/target"), true);
233-
let (_reports, count, fails) = check_files(files, None);
233+
let (_reports, count, fails) = check_files(files, &None);
234234

235235
// Display results.
236236
println!("Ran {} idempotent tests.", count);
@@ -251,7 +251,7 @@ fn self_tests() {
251251
}
252252
files.push(PathBuf::from("src/lib.rs"));
253253

254-
let (reports, count, fails) = check_files(files, Some(PathBuf::from("rustfmt.toml")));
254+
let (reports, count, fails) = check_files(files, &Some(PathBuf::from("rustfmt.toml")));
255255
let mut warnings = 0;
256256

257257
// Display results.
@@ -340,7 +340,7 @@ fn format_lines_errors_are_reported_with_tabs() {
340340

341341
// For each file, run rustfmt and collect the output.
342342
// Returns the number of files checked and the number of failures.
343-
fn check_files(files: Vec<PathBuf>, opt_config: Option<PathBuf>) -> (Vec<FormatReport>, u32, u32) {
343+
fn check_files(files: Vec<PathBuf>, opt_config: &Option<PathBuf>) -> (Vec<FormatReport>, u32, u32) {
344344
let mut count = 0;
345345
let mut fails = 0;
346346
let mut reports = vec![];

Diff for: src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ impl Rewrite for ast::GenericBound {
492492
match *self {
493493
ast::GenericBound::Trait(ref poly_trait_ref, trait_bound_modifier) => {
494494
let snippet = context.snippet(self.span());
495-
let has_paren = snippet.starts_with("(") && snippet.ends_with(")");
495+
let has_paren = snippet.starts_with('(') && snippet.ends_with(')');
496496
let rewrite = match trait_bound_modifier {
497497
ast::TraitBoundModifier::None => poly_trait_ref.rewrite(context, shape),
498498
ast::TraitBoundModifier::Maybe => poly_trait_ref

0 commit comments

Comments
 (0)