Add explain_reason: false
in future_incompatible.
This allows supressing the default warning message for future incompatible ints, for lints that already provide a more detailed warning.
This commit is contained in:
parent
543ab99640
commit
7f4e343893
2 changed files with 14 additions and 3 deletions
|
@ -145,6 +145,11 @@ pub struct FutureIncompatibleInfo {
|
||||||
/// The reason for the lint used by diagnostics to provide
|
/// The reason for the lint used by diagnostics to provide
|
||||||
/// the right help message
|
/// the right help message
|
||||||
pub reason: FutureIncompatibilityReason,
|
pub reason: FutureIncompatibilityReason,
|
||||||
|
/// Whether to explain the reason to the user.
|
||||||
|
///
|
||||||
|
/// Set to false for lints that already include a more detailed
|
||||||
|
/// explanation.
|
||||||
|
pub explain_reason: bool,
|
||||||
/// Information about a future breakage, which will
|
/// Information about a future breakage, which will
|
||||||
/// be emitted in JSON messages to be displayed by Cargo
|
/// be emitted in JSON messages to be displayed by Cargo
|
||||||
/// for upstream deps
|
/// for upstream deps
|
||||||
|
@ -185,6 +190,7 @@ impl FutureIncompatibleInfo {
|
||||||
FutureIncompatibleInfo {
|
FutureIncompatibleInfo {
|
||||||
reference: "",
|
reference: "",
|
||||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||||
|
explain_reason: true,
|
||||||
future_breakage: None,
|
future_breakage: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,10 +398,15 @@ pub fn struct_lint_level<'s, 'd>(
|
||||||
it will become a hard error in a future release!"
|
it will become a hard error in a future release!"
|
||||||
.to_owned()
|
.to_owned()
|
||||||
};
|
};
|
||||||
let citation = format!("for more information, see {}", future_incompatible.reference);
|
if future_incompatible.explain_reason {
|
||||||
err.warn(&explanation);
|
err.warn(&explanation);
|
||||||
|
}
|
||||||
|
if !future_incompatible.reference.is_empty() {
|
||||||
|
let citation =
|
||||||
|
format!("for more information, see {}", future_incompatible.reference);
|
||||||
err.note(&citation);
|
err.note(&citation);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Finally, run `decorate`. This function is also responsible for emitting the diagnostic.
|
// Finally, run `decorate`. This function is also responsible for emitting the diagnostic.
|
||||||
decorate(LintDiagnosticBuilder::new(err));
|
decorate(LintDiagnosticBuilder::new(err));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue