Tweak note condition

This commit is contained in:
Yuki Okushi
2026-03-06 05:49:20 +09:00
parent 2071c66f19
commit cbaee5df1b
3 changed files with 2 additions and 4 deletions
+1 -1
View File
@@ -214,7 +214,7 @@ fn interior_mutability_suggestion(
let sugg =
static_mutability_span(cx, def_id).map(|span| StaticMutRefsInteriorMutabilitySugg { span });
(true, sugg)
(sugg.is_none(), sugg)
}
fn static_mutability_span(cx: &LateContext<'_>, def_id: DefId) -> Option<Span> {
@@ -4,9 +4,8 @@ error: creating a shared reference to mutable static
LL | let _lock = unsafe { STDINOUT_MUTEX.lock().unwrap() };
| ^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
|
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
= help: use a type that relies on "interior mutability" instead; to read more on this, visit <https://doc.rust-lang.org/reference/interior-mutability.html>
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
= note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default
help: this type already provides "interior mutability", so its binding doesn't need to be declared as mutable
|
@@ -10,7 +10,6 @@ LL | | });
| |______________^ shared reference to mutable static
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
= help: use a type that relies on "interior mutability" instead; to read more on this, visit <https://doc.rust-lang.org/reference/interior-mutability.html>
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
= note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default
help: this type already provides "interior mutability", so its binding doesn't need to be declared as mutable