Add new type-mismatch diagnostic

This commit is contained in:
Florian Diebold 2022-03-20 16:26:48 +01:00
parent 2d30dd67d3
commit ab3313b1cb
7 changed files with 151 additions and 81 deletions

View file

@ -38,6 +38,22 @@ impl Mutability {
Mutability::Mut => "mut ",
}
}
/// Returns `true` if the mutability is [`Mut`].
///
/// [`Mut`]: Mutability::Mut
#[must_use]
pub fn is_mut(&self) -> bool {
matches!(self, Self::Mut)
}
/// Returns `true` if the mutability is [`Shared`].
///
/// [`Shared`]: Mutability::Shared
#[must_use]
pub fn is_shared(&self) -> bool {
matches!(self, Self::Shared)
}
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]