use drain_filter instead of filter and retain

This commit is contained in:
Takayuki Maeda 2021-09-25 11:33:53 +09:00
parent 353d6373ff
commit 4c23905515
2 changed files with 2 additions and 4 deletions

View File

@ -1708,10 +1708,7 @@ fn find_span_immediately_after_crate_name(
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();

View File

@ -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)]