@@ -175,11 +175,9 @@ impl Item {
175
175
}
176
176
177
177
crate fn is_crate ( & self ) -> bool {
178
- match * self . kind {
178
+ matches ! ( * self . kind,
179
179
StrippedItem ( box ModuleItem ( Module { is_crate: true , .. } ) )
180
- | ModuleItem ( Module { is_crate : true , .. } ) => true ,
181
- _ => false ,
182
- }
180
+ | ModuleItem ( Module { is_crate: true , .. } ) )
183
181
}
184
182
crate fn is_mod ( & self ) -> bool {
185
183
self . type_ ( ) == ItemType :: Module
@@ -378,10 +376,7 @@ impl ItemKind {
378
376
}
379
377
380
378
crate fn is_type_alias ( & self ) -> bool {
381
- match * self {
382
- ItemKind :: TypedefItem ( _, _) | ItemKind :: AssocTypeItem ( _, _) => true ,
383
- _ => false ,
384
- }
379
+ matches ! ( self , ItemKind :: TypedefItem ( ..) | ItemKind :: AssocTypeItem ( ..) )
385
380
}
386
381
}
387
382
@@ -674,7 +669,7 @@ impl Attributes {
674
669
span : attr. span ,
675
670
doc : contents,
676
671
kind : DocFragmentKind :: Include { filename } ,
677
- parent_module : parent_module ,
672
+ parent_module,
678
673
} ) ;
679
674
}
680
675
}
@@ -750,7 +745,7 @@ impl Attributes {
750
745
Some ( did) => {
751
746
if let Some ( ( mut href, ..) ) = href ( did) {
752
747
if let Some ( ref fragment) = * fragment {
753
- href. push_str ( "#" ) ;
748
+ href. push ( '#' ) ;
754
749
href. push_str ( fragment) ;
755
750
}
756
751
Some ( RenderedLink {
@@ -945,10 +940,7 @@ crate enum GenericParamDefKind {
945
940
946
941
impl GenericParamDefKind {
947
942
crate fn is_type ( & self ) -> bool {
948
- match * self {
949
- GenericParamDefKind :: Type { .. } => true ,
950
- _ => false ,
951
- }
943
+ matches ! ( self , GenericParamDefKind :: Type { .. } )
952
944
}
953
945
954
946
// FIXME(eddyb) this either returns the default of a type parameter, or the
@@ -1292,15 +1284,12 @@ impl Type {
1292
1284
}
1293
1285
1294
1286
crate fn is_full_generic ( & self ) -> bool {
1295
- match * self {
1296
- Type :: Generic ( _) => true ,
1297
- _ => false ,
1298
- }
1287
+ matches ! ( self , Type :: Generic ( _) )
1299
1288
}
1300
1289
1301
1290
crate fn projection ( & self ) -> Option < ( & Type , DefId , Symbol ) > {
1302
1291
let ( self_, trait_, name) = match self {
1303
- QPath { ref self_type, ref trait_, name } => ( self_type, trait_, name) ,
1292
+ QPath { self_type, trait_, name } => ( self_type, trait_, name) ,
1304
1293
_ => return None ,
1305
1294
} ;
1306
1295
let trait_did = match * * trait_ {
0 commit comments