1
Fork 0

Add Mutability::{is_mut,is_not}

This commit is contained in:
Maybe Waffle 2022-11-23 18:22:51 +00:00
parent 9b9c7d0ecc
commit da40965300
14 changed files with 29 additions and 26 deletions

View file

@ -1059,7 +1059,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
{
(
mk_result(old_pred.map_bound(|trait_pred| (trait_pred, *ty))),
matches!(mutability, hir::Mutability::Mut),
mutability.is_mut(),
)
} else {
(false, false)
@ -1348,7 +1348,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
.sess
.source_map()
.span_take_while(span, |c| c.is_whitespace() || *c == '&');
if points_at_arg && mutability == hir::Mutability::Not && refs_number > 0 {
if points_at_arg && mutability.is_not() && refs_number > 0 {
err.span_suggestion_verbose(
sp,
"consider changing this borrow's mutability",