Add Mutability::{is_mut,is_not}
This commit is contained in:
parent
9b9c7d0ecc
commit
da40965300
14 changed files with 29 additions and 26 deletions
|
@ -803,6 +803,16 @@ impl Mutability {
|
|||
Mutability::Mut => "&mut ",
|
||||
}
|
||||
}
|
||||
|
||||
/// Return `true` if self is mutable
|
||||
pub fn is_mut(self) -> bool {
|
||||
matches!(self, Self::Mut)
|
||||
}
|
||||
|
||||
/// Return `true` if self is **not** mutable
|
||||
pub fn is_not(self) -> bool {
|
||||
matches!(self, Self::Not)
|
||||
}
|
||||
}
|
||||
|
||||
/// The kind of borrow in an `AddrOf` expression,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue