File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,11 @@ pub struct FutureIncompatibleInfo {
145145 /// The reason for the lint used by diagnostics to provide
146146 /// the right help message
147147 pub reason : FutureIncompatibilityReason ,
148+ /// Whether to explain the reason to the user.
149+ ///
150+ /// Set to false for lints that already include a more detailed
151+ /// explanation.
152+ pub explain_reason : bool ,
148153 /// Information about a future breakage, which will
149154 /// be emitted in JSON messages to be displayed by Cargo
150155 /// for upstream deps
@@ -185,6 +190,7 @@ impl FutureIncompatibleInfo {
185190 FutureIncompatibleInfo {
186191 reference : "" ,
187192 reason : FutureIncompatibilityReason :: FutureReleaseError ,
193+ explain_reason : true ,
188194 future_breakage : None ,
189195 }
190196 }
Original file line number Diff line number Diff line change @@ -398,9 +398,14 @@ pub fn struct_lint_level<'s, 'd>(
398398 it will become a hard error in a future release!"
399399 . to_owned ( )
400400 } ;
401- let citation = format ! ( "for more information, see {}" , future_incompatible. reference) ;
402- err. warn ( & explanation) ;
403- err. note ( & citation) ;
401+ if future_incompatible. explain_reason {
402+ err. warn ( & explanation) ;
403+ }
404+ if !future_incompatible. reference . is_empty ( ) {
405+ let citation =
406+ format ! ( "for more information, see {}" , future_incompatible. reference) ;
407+ err. note ( & citation) ;
408+ }
404409 }
405410
406411 // Finally, run `decorate`. This function is also responsible for emitting the diagnostic.
You can’t perform that action at this time.
0 commit comments