@@ -1164,82 +1164,63 @@ pub enum PlaceContext {
11641164impl PlaceContext {
11651165 /// Returns `true` if this place context represents a drop.
11661166 pub fn is_drop ( & self ) -> bool {
1167- match * self {
1168- PlaceContext :: MutatingUse ( MutatingUseContext :: Drop ) => true ,
1169- _ => false ,
1170- }
1167+ matches ! ( self , PlaceContext :: MutatingUse ( MutatingUseContext :: Drop ) )
11711168 }
11721169
11731170 /// Returns `true` if this place context represents a borrow.
11741171 pub fn is_borrow ( & self ) -> bool {
1175- match * self {
1172+ matches ! (
1173+ self ,
11761174 PlaceContext :: NonMutatingUse (
11771175 NonMutatingUseContext :: SharedBorrow
1178- | NonMutatingUseContext :: ShallowBorrow
1179- | NonMutatingUseContext :: UniqueBorrow ,
1180- )
1181- | PlaceContext :: MutatingUse ( MutatingUseContext :: Borrow ) => true ,
1182- _ => false ,
1183- }
1176+ | NonMutatingUseContext :: ShallowBorrow
1177+ | NonMutatingUseContext :: UniqueBorrow
1178+ ) | PlaceContext :: MutatingUse ( MutatingUseContext :: Borrow )
1179+ )
11841180 }
11851181
11861182 /// Returns `true` if this place context represents a storage live or storage dead marker.
11871183 pub fn is_storage_marker ( & self ) -> bool {
1188- match * self {
1189- PlaceContext :: NonUse ( NonUseContext :: StorageLive | NonUseContext :: StorageDead ) => true ,
1190- _ => false ,
1191- }
1184+ matches ! (
1185+ self ,
1186+ PlaceContext :: NonUse ( NonUseContext :: StorageLive | NonUseContext :: StorageDead )
1187+ )
11921188 }
11931189
11941190 /// Returns `true` if this place context represents a storage live marker.
11951191 pub fn is_storage_live_marker ( & self ) -> bool {
1196- match * self {
1197- PlaceContext :: NonUse ( NonUseContext :: StorageLive ) => true ,
1198- _ => false ,
1199- }
1192+ matches ! ( self , PlaceContext :: NonUse ( NonUseContext :: StorageLive ) )
12001193 }
12011194
12021195 /// Returns `true` if this place context represents a storage dead marker.
12031196 pub fn is_storage_dead_marker ( & self ) -> bool {
1204- match * self {
1205- PlaceContext :: NonUse ( NonUseContext :: StorageDead ) => true ,
1206- _ => false ,
1207- }
1197+ matches ! ( self , PlaceContext :: NonUse ( NonUseContext :: StorageDead ) )
12081198 }
12091199
12101200 /// Returns `true` if this place context represents a use that potentially changes the value.
12111201 pub fn is_mutating_use ( & self ) -> bool {
1212- match * self {
1213- PlaceContext :: MutatingUse ( ..) => true ,
1214- _ => false ,
1215- }
1202+ matches ! ( self , PlaceContext :: MutatingUse ( ..) )
12161203 }
12171204
12181205 /// Returns `true` if this place context represents a use that does not change the value.
12191206 pub fn is_nonmutating_use ( & self ) -> bool {
1220- match * self {
1221- PlaceContext :: NonMutatingUse ( ..) => true ,
1222- _ => false ,
1223- }
1207+ matches ! ( self , PlaceContext :: NonMutatingUse ( ..) )
12241208 }
12251209
12261210 /// Returns `true` if this place context represents a use.
12271211 pub fn is_use ( & self ) -> bool {
1228- match * self {
1229- PlaceContext :: NonUse ( ..) => false ,
1230- _ => true ,
1231- }
1212+ !matches ! ( self , PlaceContext :: NonUse ( ..) )
12321213 }
12331214
12341215 /// Returns `true` if this place context represents an assignment statement.
12351216 pub fn is_place_assignment ( & self ) -> bool {
1236- match * self {
1217+ matches ! (
1218+ self ,
12371219 PlaceContext :: MutatingUse (
12381220 MutatingUseContext :: Store
1239- | MutatingUseContext :: Call
1240- | MutatingUseContext :: AsmOutput ,
1241- ) => true ,
1242- _ => false ,
1243- }
1221+ | MutatingUseContext :: Call
1222+ | MutatingUseContext :: AsmOutput ,
1223+ )
1224+ )
12441225 }
12451226}
0 commit comments