@@ -221,7 +221,6 @@ pub fn struct_lint_level<'s, 'd>(
221221 decorate : Box < dyn for < ' b > FnOnce ( LintDiagnosticBuilder < ' b > ) + ' d > ,
222222 ) {
223223 // Check for future incompatibility lints and issue a stronger warning.
224- let lint_id = LintId :: of ( lint) ;
225224 let future_incompatible = lint. future_incompatible ;
226225
227226 let has_future_breakage = future_incompatible. map_or (
@@ -345,31 +344,29 @@ pub fn struct_lint_level<'s, 'd>(
345344 err. code ( DiagnosticId :: Lint { name, has_future_breakage, is_force_warn } ) ;
346345
347346 if let Some ( future_incompatible) = future_incompatible {
348- let explanation = if lint_id == LintId :: of ( builtin:: UNSTABLE_NAME_COLLISIONS ) {
349- "once this associated item is added to the standard library, the ambiguity may \
350- cause an error or change in behavior!"
351- . to_owned ( )
352- } else if lint_id == LintId :: of ( builtin:: MUTABLE_BORROW_RESERVATION_CONFLICT ) {
353- "this borrowing pattern was not meant to be accepted, and may become a hard error \
354- in the future"
355- . to_owned ( )
356- } else if let FutureIncompatibilityReason :: EditionError ( edition) =
357- future_incompatible. reason
358- {
359- let current_edition = sess. edition ( ) ;
360- format ! (
361- "this is accepted in the current edition (Rust {}) but is a hard error in Rust {}!" ,
362- current_edition, edition
363- )
364- } else if let FutureIncompatibilityReason :: EditionSemanticsChange ( edition) =
365- future_incompatible. reason
366- {
367- format ! ( "this changes meaning in Rust {}" , edition)
368- } else {
369- "this was previously accepted by the compiler but is being phased out; \
370- it will become a hard error in a future release!"
371- . to_owned ( )
347+ let explanation = match future_incompatible. reason {
348+ FutureIncompatibilityReason :: FutureReleaseError
349+ | FutureIncompatibilityReason :: FutureReleaseErrorReportNow => {
350+ "this was previously accepted by the compiler but is being phased out; \
351+ it will become a hard error in a future release!"
352+ . to_owned ( )
353+ }
354+ FutureIncompatibilityReason :: FutureReleaseSemanticsChange => {
355+ "this will change its meaning in a future release!" . to_owned ( )
356+ }
357+ FutureIncompatibilityReason :: EditionError ( edition) => {
358+ let current_edition = sess. edition ( ) ;
359+ format ! (
360+ "this is accepted in the current edition (Rust {}) but is a hard error in Rust {}!" ,
361+ current_edition, edition
362+ )
363+ }
364+ FutureIncompatibilityReason :: EditionSemanticsChange ( edition) => {
365+ format ! ( "this changes meaning in Rust {}" , edition)
366+ }
367+ FutureIncompatibilityReason :: Custom ( reason) => reason. to_owned ( ) ,
372368 } ;
369+
373370 if future_incompatible. explain_reason {
374371 err. warn ( & explanation) ;
375372 }
0 commit comments