Skip to content

Commit

Permalink
Merge pull request rust-lang#3205 from matthiaskrgr/clippy
Browse files Browse the repository at this point in the history
fix a few clippy warnings
  • Loading branch information
nrc authored Nov 17, 2018
2 parents fa9fd5c + 3aa1533 commit ef4176a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/config/file_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fn normalize_ranges(ranges: &mut HashMap<FileName, Vec<Range>>) {
ranges.sort();
let mut result = vec![];
{
let mut iter = ranges.into_iter().peekable();
let mut iter = ranges.iter_mut().peekable();
while let Some(next) = iter.next() {
let mut next = *next;
while let Some(&&mut peek) = iter.peek() {
Expand Down
2 changes: 1 addition & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ fn rewrite_struct_lit<'a>(
)?
} else {
let field_iter = fields
.into_iter()
.iter()
.map(StructLitField::Regular)
.chain(base.into_iter().map(StructLitField::Base));

Expand Down
2 changes: 1 addition & 1 deletion src/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ fn rewrite_tuple_pat(
context: &RewriteContext,
shape: Shape,
) -> Option<String> {
let mut pat_vec: Vec<_> = pats.into_iter().map(|x| TuplePatField::Pat(x)).collect();
let mut pat_vec: Vec<_> = pats.iter().map(|x| TuplePatField::Pat(x)).collect();

if let Some(pos) = dotdot_pos {
let prev = if pos == 0 {
Expand Down
10 changes: 5 additions & 5 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn write_message(msg: &str) {
fn system_tests() {
// Get all files in the tests/source directory.
let files = get_test_files(Path::new("tests/source"), true);
let (_reports, count, fails) = check_files(files, None);
let (_reports, count, fails) = check_files(files, &None);

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

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

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

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

// Display results.
Expand Down Expand Up @@ -340,7 +340,7 @@ fn format_lines_errors_are_reported_with_tabs() {

// For each file, run rustfmt and collect the output.
// Returns the number of files checked and the number of failures.
fn check_files(files: Vec<PathBuf>, opt_config: Option<PathBuf>) -> (Vec<FormatReport>, u32, u32) {
fn check_files(files: Vec<PathBuf>, opt_config: &Option<PathBuf>) -> (Vec<FormatReport>, u32, u32) {
let mut count = 0;
let mut fails = 0;
let mut reports = vec![];
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ impl Rewrite for ast::GenericBound {
match *self {
ast::GenericBound::Trait(ref poly_trait_ref, trait_bound_modifier) => {
let snippet = context.snippet(self.span());
let has_paren = snippet.starts_with("(") && snippet.ends_with(")");
let has_paren = snippet.starts_with('(') && snippet.ends_with(')');
let rewrite = match trait_bound_modifier {
ast::TraitBoundModifier::None => poly_trait_ref.rewrite(context, shape),
ast::TraitBoundModifier::Maybe => poly_trait_ref
Expand Down

0 comments on commit ef4176a

Please sign in to comment.