File tree Expand file tree Collapse file tree 2 files changed +14
-26
lines changed Expand file tree Collapse file tree 2 files changed +14
-26
lines changed Original file line number Diff line number Diff line change @@ -1042,30 +1042,18 @@ impl Type {
1042
1042
}
1043
1043
1044
1044
pub fn is_bool ( & self ) -> bool {
1045
- match & self . ty . value {
1046
- Ty :: Apply ( a_ty) => match a_ty. ctor {
1047
- TypeCtor :: Bool => true ,
1048
- _ => false ,
1049
- } ,
1050
- _ => false ,
1051
- }
1045
+ matches ! ( self . ty. value, Ty :: Apply ( ApplicationTy { ctor: TypeCtor :: Bool , .. } ) )
1052
1046
}
1053
1047
1054
1048
pub fn is_mutable_reference ( & self ) -> bool {
1055
- match & self . ty . value {
1056
- Ty :: Apply ( a_ty) => match a_ty. ctor {
1057
- TypeCtor :: Ref ( Mutability :: Mut ) => true ,
1058
- _ => false ,
1059
- } ,
1060
- _ => false ,
1061
- }
1049
+ matches ! (
1050
+ self . ty. value,
1051
+ Ty :: Apply ( ApplicationTy { ctor: TypeCtor :: Ref ( Mutability :: Mut ) , .. } )
1052
+ )
1062
1053
}
1063
1054
1064
1055
pub fn is_unknown ( & self ) -> bool {
1065
- match & self . ty . value {
1066
- Ty :: Unknown => true ,
1067
- _ => false ,
1068
- }
1056
+ matches ! ( self . ty. value, Ty :: Unknown )
1069
1057
}
1070
1058
1071
1059
/// Checks that particular type `ty` implements `std::future::Future`.
Original file line number Diff line number Diff line change @@ -95,14 +95,14 @@ impl Ty {
95
95
// Types like slice can have inherent impls in several crates, (core and alloc).
96
96
// The corresponding impls are marked with lang items, so we can use them to find the required crates.
97
97
macro_rules! lang_item_crate {
98
- ( $( $name: expr) ,+ $( , ) ?) => { {
99
- let mut v = ArrayVec :: <[ LangItemTarget ; 2 ] >:: new( ) ;
100
- $(
101
- v. extend( db. lang_item( cur_crate, $name. into( ) ) ) ;
102
- ) +
103
- v
104
- } } ;
105
- }
98
+ ( $( $name: expr) ,+ $( , ) ?) => { {
99
+ let mut v = ArrayVec :: <[ LangItemTarget ; 2 ] >:: new( ) ;
100
+ $(
101
+ v. extend( db. lang_item( cur_crate, $name. into( ) ) ) ;
102
+ ) +
103
+ v
104
+ } } ;
105
+ }
106
106
107
107
let lang_item_targets = match self {
108
108
Ty :: Apply ( a_ty) => match a_ty. ctor {
You can’t perform that action at this time.
0 commit comments