File tree Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use std::collections::hash_map::Entry;
5
5
6
6
use base_db:: CrateId ;
7
7
use hir_expand:: { name:: Name , AstId , MacroCallId } ;
8
+ use itertools:: Itertools ;
8
9
use once_cell:: sync:: Lazy ;
9
10
use profile:: Count ;
10
11
use rustc_hash:: { FxHashMap , FxHashSet } ;
@@ -97,15 +98,14 @@ pub(crate) enum BuiltinShadowMode {
97
98
impl ItemScope {
98
99
pub fn entries < ' a > ( & ' a self ) -> impl Iterator < Item = ( & ' a Name , PerNs ) > + ' a {
99
100
// FIXME: shadowing
100
- let keys: FxHashSet < _ > = self
101
- . types
101
+ self . types
102
102
. keys ( )
103
103
. chain ( self . values . keys ( ) )
104
104
. chain ( self . macros . keys ( ) )
105
105
. chain ( self . unresolved . iter ( ) )
106
- . collect ( ) ;
107
-
108
- keys . into_iter ( ) . map ( move |name| ( name, self . get ( name) ) )
106
+ . sorted ( )
107
+ . unique ( )
108
+ . map ( move |name| ( name, self . get ( name) ) )
109
109
}
110
110
111
111
pub fn declarations ( & self ) -> impl Iterator < Item = ModuleDefId > + ' _ {
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ use crate::{
36
36
// pub struct Baz;
37
37
// }
38
38
//
39
- // use foo::{Baz, Bar };
39
+ // use foo::{Bar, Baz };
40
40
//
41
41
// fn qux(bar: Bar, baz: Baz) {}
42
42
// ```
@@ -281,7 +281,7 @@ mod foo {
281
281
pub fn f() {}
282
282
}
283
283
284
- use foo::{Baz, Bar , f};
284
+ use foo::{Bar, Baz , f};
285
285
286
286
fn qux(bar: Bar, baz: Baz) {
287
287
f();
@@ -351,7 +351,7 @@ mod foo {
351
351
pub fn f() {}
352
352
}
353
353
354
- use foo::{Baz, Bar , f};
354
+ use foo::{Bar, Baz , f};
355
355
356
356
fn qux(bar: Bar, baz: Baz) {
357
357
f();
@@ -440,7 +440,7 @@ mod foo {
440
440
}
441
441
}
442
442
443
- use foo::{bar::{Baz, Bar , f}, baz::*};
443
+ use foo::{bar::{Bar, Baz , f}, baz::*};
444
444
445
445
fn qux(bar: Bar, baz: Baz) {
446
446
f();
@@ -561,7 +561,7 @@ mod foo {
561
561
562
562
use foo::{
563
563
bar::{*, f},
564
- baz::{g, qux::{q, h }}
564
+ baz::{g, qux::{h, q }}
565
565
};
566
566
567
567
fn qux(bar: Bar, baz: Baz) {
Original file line number Diff line number Diff line change @@ -535,7 +535,7 @@ mod foo {
535
535
pub struct Baz;
536
536
}
537
537
538
- use foo::{Baz, Bar };
538
+ use foo::{Bar, Baz };
539
539
540
540
fn qux(bar: Bar, baz: Baz) {}
541
541
"##### ,
Original file line number Diff line number Diff line change @@ -1271,8 +1271,8 @@ fn main() {
1271
1271
st S []
1272
1272
st &mut S [type]
1273
1273
st S []
1274
- fn main() []
1275
1274
fn foo(…) []
1275
+ fn main() []
1276
1276
"# ] ] ,
1277
1277
) ;
1278
1278
check_relevance (
@@ -1288,8 +1288,8 @@ fn main() {
1288
1288
lc s [type+name+local]
1289
1289
st S [type]
1290
1290
st S []
1291
- fn main() []
1292
1291
fn foo(…) []
1292
+ fn main() []
1293
1293
"# ] ] ,
1294
1294
) ;
1295
1295
check_relevance (
@@ -1305,8 +1305,8 @@ fn main() {
1305
1305
lc ssss [type+local]
1306
1306
st S [type]
1307
1307
st S []
1308
- fn main() []
1309
1308
fn foo(…) []
1309
+ fn main() []
1310
1310
"# ] ] ,
1311
1311
) ;
1312
1312
}
@@ -1342,10 +1342,10 @@ fn main() {
1342
1342
lc &t [type+local]
1343
1343
st S []
1344
1344
st &S [type]
1345
- st T []
1346
1345
st S []
1347
- fn main() []
1346
+ st T []
1348
1347
fn foo(…) []
1348
+ fn main() []
1349
1349
md core []
1350
1350
"# ] ] ,
1351
1351
)
@@ -1388,10 +1388,10 @@ fn main() {
1388
1388
lc &mut t [type+local]
1389
1389
st S []
1390
1390
st &mut S [type]
1391
- st T []
1392
1391
st S []
1393
- fn main() []
1392
+ st T []
1394
1393
fn foo(…) []
1394
+ fn main() []
1395
1395
md core []
1396
1396
"# ] ] ,
1397
1397
)
@@ -1483,12 +1483,12 @@ fn main() {
1483
1483
expect ! [ [ r#"
1484
1484
st S []
1485
1485
st &S [type]
1486
- st T []
1487
1486
st S []
1488
- fn main() []
1487
+ st T []
1489
1488
fn bar() []
1490
1489
fn &bar() [type]
1491
1490
fn foo(…) []
1491
+ fn main() []
1492
1492
md core []
1493
1493
"# ] ] ,
1494
1494
)
@@ -1633,8 +1633,8 @@ fn foo() {
1633
1633
ev Foo::B [type_could_unify]
1634
1634
fn foo() []
1635
1635
en Foo []
1636
- fn baz() []
1637
1636
fn bar() []
1637
+ fn baz() []
1638
1638
"# ] ] ,
1639
1639
) ;
1640
1640
}
@@ -1724,9 +1724,9 @@ fn f() {
1724
1724
}
1725
1725
"# ,
1726
1726
expect ! [ [ r#"
1727
- md std []
1728
1727
st Buffer []
1729
1728
fn f() []
1729
+ md std []
1730
1730
tt BufRead (use std::io::BufRead) [requires_import]
1731
1731
st BufReader (use std::io::BufReader) [requires_import]
1732
1732
st BufWriter (use std::io::BufWriter) [requires_import]
You can’t perform that action at this time.
0 commit comments