Skip to content

Commit

Permalink
Clean up mut keyword check
Browse files Browse the repository at this point in the history
  • Loading branch information
RedDocMD committed Dec 14, 2022
1 parent 9c8bf51 commit afefbb6
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1369,13 +1369,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
.span_take_while(span, |c| c.is_whitespace() || *c == '&');
if points_at_arg && mutability.is_not() && refs_number > 0 {
// If we have a call like foo(&mut buf), then don't suggest foo(&mut mut buf)
if "mut"
== snippet
.chars()
.filter(|c| !c.is_whitespace())
.skip(refs_number)
.take(3)
.collect::<String>()
if snippet
.trim_start_matches(|c: char| c.is_whitespace() || c == '&')
.starts_with("mut")
{
return;
}
Expand Down

0 comments on commit afefbb6

Please sign in to comment.