@@ -1164,82 +1164,63 @@ pub enum PlaceContext {
1164
1164
impl PlaceContext {
1165
1165
/// Returns `true` if this place context represents a drop.
1166
1166
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 ) )
1171
1168
}
1172
1169
1173
1170
/// Returns `true` if this place context represents a borrow.
1174
1171
pub fn is_borrow ( & self ) -> bool {
1175
- match * self {
1172
+ matches ! (
1173
+ self ,
1176
1174
PlaceContext :: NonMutatingUse (
1177
1175
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
+ )
1184
1180
}
1185
1181
1186
1182
/// Returns `true` if this place context represents a storage live or storage dead marker.
1187
1183
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
+ )
1192
1188
}
1193
1189
1194
1190
/// Returns `true` if this place context represents a storage live marker.
1195
1191
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 ) )
1200
1193
}
1201
1194
1202
1195
/// Returns `true` if this place context represents a storage dead marker.
1203
1196
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 ) )
1208
1198
}
1209
1199
1210
1200
/// Returns `true` if this place context represents a use that potentially changes the value.
1211
1201
pub fn is_mutating_use ( & self ) -> bool {
1212
- match * self {
1213
- PlaceContext :: MutatingUse ( ..) => true ,
1214
- _ => false ,
1215
- }
1202
+ matches ! ( self , PlaceContext :: MutatingUse ( ..) )
1216
1203
}
1217
1204
1218
1205
/// Returns `true` if this place context represents a use that does not change the value.
1219
1206
pub fn is_nonmutating_use ( & self ) -> bool {
1220
- match * self {
1221
- PlaceContext :: NonMutatingUse ( ..) => true ,
1222
- _ => false ,
1223
- }
1207
+ matches ! ( self , PlaceContext :: NonMutatingUse ( ..) )
1224
1208
}
1225
1209
1226
1210
/// Returns `true` if this place context represents a use.
1227
1211
pub fn is_use ( & self ) -> bool {
1228
- match * self {
1229
- PlaceContext :: NonUse ( ..) => false ,
1230
- _ => true ,
1231
- }
1212
+ !matches ! ( self , PlaceContext :: NonUse ( ..) )
1232
1213
}
1233
1214
1234
1215
/// Returns `true` if this place context represents an assignment statement.
1235
1216
pub fn is_place_assignment ( & self ) -> bool {
1236
- match * self {
1217
+ matches ! (
1218
+ self ,
1237
1219
PlaceContext :: MutatingUse (
1238
1220
MutatingUseContext :: Store
1239
- | MutatingUseContext :: Call
1240
- | MutatingUseContext :: AsmOutput ,
1241
- ) => true ,
1242
- _ => false ,
1243
- }
1221
+ | MutatingUseContext :: Call
1222
+ | MutatingUseContext :: AsmOutput ,
1223
+ )
1224
+ )
1244
1225
}
1245
1226
}
0 commit comments