Skip to content

Commit

Permalink
use drain_filter instead of filter and retain
Browse files Browse the repository at this point in the history
  • Loading branch information
TaKO8Ki committed Sep 25, 2021
1 parent 353d637 commit 4c23905
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,10 +1708,7 @@ crate fn show_candidates(

path_strings.sort();
let core_path_strings =
path_strings.iter().filter(|p| p.starts_with("core::")).cloned().collect::<Vec<String>>();
if !core_path_strings.is_empty() {
path_strings.retain(|p| !p.starts_with("core::"));
}
path_strings.drain_filter(|p| p.starts_with("core::")).collect::<Vec<String>>();
path_strings.extend(core_path_strings);
path_strings.dedup();

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(box_patterns)]
#![feature(drain_filter)]
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
#![feature(format_args_capture)]
Expand Down

0 comments on commit 4c23905

Please sign in to comment.