diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 7e79de102ae..937319df18a 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -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::>(); - if !core_path_strings.is_empty() { - path_strings.retain(|p| !p.starts_with("core::")); - } + path_strings.drain_filter(|p| p.starts_with("core::")).collect::>(); path_strings.extend(core_path_strings); path_strings.dedup(); diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index d76ba80e42e..a9609f188bc 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -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)]