Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Jul 27, 2018
1 parent 4c1cb75 commit 1bc49a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/librustc_driver/lib.rs
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/profile/trace.rs
Expand Up @@ -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,
Expand Down
10 changes: 4 additions & 6 deletions src/librustc_mir/monomorphize/mod.rs
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit 1bc49a9

Please sign in to comment.