mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
Perf + Test Case RE: ShoyuVanilla
This commit is contained in:
@@ -1528,6 +1528,16 @@ fn merge_gated_imports_with_different_values() {
|
||||
assert_eq!(result, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn merge_gated_imports_different_order() {
|
||||
check_merge(
|
||||
r#"#[cfg(a)] #[cfg(b)] use foo::bar;"#,
|
||||
r#"#[cfg(b)] #[cfg(a)] use foo::baz;"#,
|
||||
r#"#[cfg(a)] #[cfg(b)] use foo::{bar, baz};"#,
|
||||
MergeBehavior::Crate,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn merge_into_existing_cfg_import() {
|
||||
check(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use itertools::{EitherOrBoth, Itertools};
|
||||
use parser::T;
|
||||
use syntax::{
|
||||
Direction, SyntaxElement, algo,
|
||||
Direction, SyntaxElement, ToSmolStr, algo,
|
||||
ast::{
|
||||
self, AstNode, HasAttrs, HasName, HasVisibility, PathSegmentKind, edit_in_place::Removable,
|
||||
make,
|
||||
@@ -691,10 +691,10 @@ pub fn eq_attrs(
|
||||
attrs0: impl Iterator<Item = ast::Attr>,
|
||||
attrs1: impl Iterator<Item = ast::Attr>,
|
||||
) -> bool {
|
||||
let mut attrs0: Vec<_> = attrs0.map(|attr| attr.syntax().text().to_string()).collect();
|
||||
let mut attrs1: Vec<_> = attrs1.map(|attr| attr.syntax().text().to_string()).collect();
|
||||
attrs0.sort();
|
||||
attrs1.sort();
|
||||
let mut attrs0: Vec<_> = attrs0.map(|attr| attr.syntax().text().to_smolstr()).collect();
|
||||
let mut attrs1: Vec<_> = attrs1.map(|attr| attr.syntax().text().to_smolstr()).collect();
|
||||
attrs0.sort_unstable();
|
||||
attrs1.sort_unstable();
|
||||
|
||||
attrs0 == attrs1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user