diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index d896df151a7dc..3ec73059721a2 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1228,7 +1228,7 @@ Available lint options: fn sort_lint_groups(lints: Vec<(&'static str, Vec, bool)>) -> Vec<(&'static str, Vec)> { let mut lints: Vec<_> = lints.into_iter().map(|(x, y, _)| (x, y)).collect(); - lints.sort_by_key(|ref l| l.0); + lints.sort_by_key(|l| l.0); lints } diff --git a/src/librustc_driver/profile/trace.rs b/src/librustc_driver/profile/trace.rs index 4aaf5eb47f61c..970a860fdff2c 100644 --- a/src/librustc_driver/profile/trace.rs +++ b/src/librustc_driver/profile/trace.rs @@ -208,7 +208,7 @@ pub fn write_counts(count_file: &mut File, counts: &mut HashMap(tcx: TyCtxt<'a, 'tcx, 'tcx>, mon (mono_item, mono_item.symbol_name(tcx)) }).collect(); - (&mut symbols[..]).sort_by_key(|&sym| sym.1); + symbols.sort_by_key(|sym| sym.1); - for pair in (&symbols[..]).windows(2) { + for pair in symbols.windows(2) { let sym1 = &pair[0].1; let sym2 = &pair[1].1; - if *sym1 == *sym2 { + if sym1 == sym2 { let mono_item1 = pair[0].0; let mono_item2 = pair[1].0; @@ -51,9 +51,7 @@ pub fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mon span2 }) } - (Some(span), None) | - (None, Some(span)) => Some(span), - _ => None + (span1, span2) => span1.or(span2), }; let error_message = format!("symbol `{}` is already defined", sym1);