Skip to content

Commit 56dd532

Browse files
committed
create note in one place
1 parent b4065d1 commit 56dd532

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

clippy_lints/src/methods/map_identity.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,12 @@ pub(super) fn check(
6363
},
6464
);
6565
if !apply {
66-
if let Some(method_requiring_mut) = method_requiring_mut {
67-
diag.span_note(
68-
caller.span,
69-
format!("this must be made mutable to use `{method_requiring_mut}`"),
70-
);
66+
let note = if let Some(method_requiring_mut) = method_requiring_mut {
67+
format!("this must be made mutable to use `{method_requiring_mut}`")
7168
} else {
72-
diag.span_note(caller.span, "this must be made mutable".to_string());
73-
}
69+
"this must be made mutable".to_string()
70+
};
71+
diag.span_note(caller.span, note);
7472
}
7573
},
7674
);

0 commit comments

Comments
 (0)