Simplify
This commit is contained in:
parent
4c1cb7534b
commit
1bc49a9743
@ -1228,7 +1228,7 @@ Available lint options:
|
||||
fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
|
||||
-> Vec<(&'static str, Vec<lint::LintId>)> {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ pub fn write_counts(count_file: &mut File, counts: &mut HashMap<String,QueryMetr
|
||||
for (ref cons, ref qm) in counts.iter() {
|
||||
data.push((cons.clone(), qm.count.clone(), qm.dur_total.clone(), qm.dur_self.clone()));
|
||||
};
|
||||
data.sort_by_key(|&k| Reverse(k.3));
|
||||
data.sort_by_key(|k| Reverse(k.3));
|
||||
for (cons, count, dur_total, dur_self) in data {
|
||||
write!(count_file, "{}, {}, {}, {}\n",
|
||||
cons, count,
|
||||
|
@ -29,13 +29,13 @@ pub fn assert_symbols_are_distinct<'a, 'tcx, I>(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);
|
||||
|
Loading…
Reference in New Issue
Block a user