@@ -16,8 +16,8 @@ use crate::utils::paths;
1616use crate :: utils:: {
1717 clip, comparisons, differing_macro_contexts, higher, in_constant, in_macro, int_bits, last_path_segment,
1818 match_def_path, match_path, multispan_sugg, opt_def_id, same_tys, sext, snippet, snippet_opt,
19- snippet_with_applicability, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then,
20- span_note_and_lint , unsext , AbsolutePathBuffer ,
19+ snippet_with_applicability, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, unsext ,
20+ AbsolutePathBuffer ,
2121} ;
2222use if_chain:: if_chain;
2323use rustc:: hir;
@@ -2291,13 +2291,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RefToMut {
22912291 if let TyKind :: Ptr ( MutTy { mutbl: Mutability :: MutImmutable , .. } ) = t. node;
22922292 if let Ref ( ..) = cx. tables. node_id_to_type( e. hir_id) . sty;
22932293 then {
2294- span_note_and_lint (
2294+ span_lint (
22952295 cx,
22962296 CAST_REF_TO_MUT ,
22972297 expr. span,
2298- "casting immutable reference to a mutable reference" ,
2299- expr. span,
2300- "consider implementing `UnsafeCell` instead" ,
2298+ "casting &T to &mut T may cause undefined behaviour, consider instead using an UnsafeCell" ,
23012299 ) ;
23022300 }
23032301 }
0 commit comments