Add deprecated_safe
lint
It warns about usages of `std::env::{set_var, remove_var}` with an automatic fix wrapping the call in an `unsafe` block.
This commit is contained in:
parent
d7680e3556
commit
44f9f8bc33
10 changed files with 172 additions and 11 deletions
|
@ -20,6 +20,25 @@ pub struct UnconditionalRecursion {
|
|||
pub call_sites: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(mir_build_call_to_deprecated_safe_fn_requires_unsafe)]
|
||||
pub struct CallToDeprecatedSafeFnRequiresUnsafe {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub function: String,
|
||||
#[subdiagnostic]
|
||||
pub sub: CallToDeprecatedSafeFnRequiresUnsafeSub,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(mir_build_suggestion, applicability = "machine-applicable")]
|
||||
pub struct CallToDeprecatedSafeFnRequiresUnsafeSub {
|
||||
#[suggestion_part(code = "unsafe {{ ")]
|
||||
pub left: Span,
|
||||
#[suggestion_part(code = " }}")]
|
||||
pub right: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe, code = E0133)]
|
||||
#[note]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue