@@ -239,7 +239,7 @@ impl Diagnostic {
239
239
}
240
240
241
241
#[ track_caller]
242
- pub fn new_with_code < M : Into < DiagnosticMessage > > (
242
+ pub ( crate ) fn new_with_code < M : Into < DiagnosticMessage > > (
243
243
level : Level ,
244
244
code : Option < DiagnosticId > ,
245
245
message : M ,
@@ -281,7 +281,7 @@ impl Diagnostic {
281
281
}
282
282
}
283
283
284
- pub fn update_unstable_expectation_id (
284
+ pub ( crate ) fn update_unstable_expectation_id (
285
285
& mut self ,
286
286
unstable_to_stable : & FxHashMap < LintExpectationId , LintExpectationId > ,
287
287
) {
@@ -307,14 +307,14 @@ impl Diagnostic {
307
307
}
308
308
309
309
/// Indicates whether this diagnostic should show up in cargo's future breakage report.
310
- pub fn has_future_breakage ( & self ) -> bool {
310
+ pub ( crate ) fn has_future_breakage ( & self ) -> bool {
311
311
match self . code {
312
312
Some ( DiagnosticId :: Lint { has_future_breakage, .. } ) => has_future_breakage,
313
313
_ => false ,
314
314
}
315
315
}
316
316
317
- pub fn is_force_warn ( & self ) -> bool {
317
+ pub ( crate ) fn is_force_warn ( & self ) -> bool {
318
318
match self . code {
319
319
Some ( DiagnosticId :: Lint { is_force_warn, .. } ) => is_force_warn,
320
320
_ => false ,
@@ -391,29 +391,6 @@ impl Diagnostic {
391
391
self . note_expected_found_extra ( expected_label, expected, found_label, found, & "" , & "" )
392
392
}
393
393
394
- pub fn note_unsuccessful_coercion (
395
- & mut self ,
396
- expected : DiagnosticStyledString ,
397
- found : DiagnosticStyledString ,
398
- ) -> & mut Self {
399
- let mut msg: Vec < _ > =
400
- vec ! [ ( Cow :: from( "required when trying to coerce from type `" ) , Style :: NoStyle ) ] ;
401
- msg. extend ( expected. 0 . iter ( ) . map ( |x| match * x {
402
- StringPart :: Normal ( ref s) => ( Cow :: from ( s. clone ( ) ) , Style :: NoStyle ) ,
403
- StringPart :: Highlighted ( ref s) => ( Cow :: from ( s. clone ( ) ) , Style :: Highlight ) ,
404
- } ) ) ;
405
- msg. push ( ( Cow :: from ( "` to type '" ) , Style :: NoStyle ) ) ;
406
- msg. extend ( found. 0 . iter ( ) . map ( |x| match * x {
407
- StringPart :: Normal ( ref s) => ( Cow :: from ( s. clone ( ) ) , Style :: NoStyle ) ,
408
- StringPart :: Highlighted ( ref s) => ( Cow :: from ( s. clone ( ) ) , Style :: Highlight ) ,
409
- } ) ) ;
410
- msg. push ( ( Cow :: from ( "`" ) , Style :: NoStyle ) ) ;
411
-
412
- // For now, just attach these as notes
413
- self . highlighted_note ( msg) ;
414
- self
415
- }
416
-
417
394
pub fn note_expected_found_extra (
418
395
& mut self ,
419
396
expected_label : & dyn fmt:: Display ,
@@ -475,7 +452,7 @@ impl Diagnostic {
475
452
self
476
453
}
477
454
478
- pub fn highlighted_note < M : Into < SubdiagnosticMessage > > (
455
+ fn highlighted_note < M : Into < SubdiagnosticMessage > > (
479
456
& mut self ,
480
457
msg : Vec < ( M , Style ) > ,
481
458
) -> & mut Self {
@@ -572,14 +549,6 @@ impl Diagnostic {
572
549
self
573
550
}
574
551
575
- /// Clear any existing suggestions.
576
- pub fn clear_suggestions ( & mut self ) -> & mut Self {
577
- if let Ok ( suggestions) = & mut self . suggestions {
578
- suggestions. clear ( ) ;
579
- }
580
- self
581
- }
582
-
583
552
/// Helper for pushing to `self.suggestions`, if available (not disable).
584
553
fn push_suggestion ( & mut self , suggestion : CodeSuggestion ) {
585
554
if let Ok ( suggestions) = & mut self . suggestions {
@@ -992,7 +961,7 @@ impl Diagnostic {
992
961
/// Helper function that takes a `SubdiagnosticMessage` and returns a `DiagnosticMessage` by
993
962
/// combining it with the primary message of the diagnostic (if translatable, otherwise it just
994
963
/// passes the user's string along).
995
- pub ( crate ) fn subdiagnostic_message_to_diagnostic_message (
964
+ fn subdiagnostic_message_to_diagnostic_message (
996
965
& self ,
997
966
attr : impl Into < SubdiagnosticMessage > ,
998
967
) -> DiagnosticMessage {
0 commit comments