Use bool in favor of Option<()> for diagnostics

This commit is contained in:
Michael Goulet 2024-08-21 00:57:58 -04:00
parent 4d5b3b1962
commit 25ff9b6bcb
48 changed files with 106 additions and 121 deletions

View file

@ -382,7 +382,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags,
multi_suggestions,
bad_label,
was_written: None,
was_written: false,
path: Default::default(),
}),
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
@ -393,7 +393,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags,
multi_suggestions,
bad_label,
was_written: None,
was_written: false,
path: Default::default(),
}),
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
@ -404,7 +404,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags,
multi_suggestions,
bad_label,
was_written: None,
was_written: false,
path: Default::default(),
}),
}
@ -586,7 +586,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags,
multi_suggestions,
bad_label: None,
was_written: path.as_ref().map(|_| ()),
was_written: path.is_some(),
path: path.unwrap_or_default(),
}),
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
@ -597,7 +597,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags,
multi_suggestions,
bad_label: None,
was_written: path.as_ref().map(|_| ()),
was_written: path.is_some(),
path: path.unwrap_or_default(),
}),
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
@ -608,7 +608,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags,
multi_suggestions,
bad_label: None,
was_written: path.as_ref().map(|_| ()),
was_written: path.is_some(),
path: path.unwrap_or_default(),
}),
}

View file

@ -203,7 +203,7 @@ pub struct AnnotationRequired<'a> {
#[subdiagnostic]
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
#[note(trait_selection_full_type_written)]
pub was_written: Option<()>,
pub was_written: bool,
pub path: PathBuf,
}
@ -224,7 +224,7 @@ pub struct AmbiguousImpl<'a> {
#[subdiagnostic]
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
#[note(trait_selection_full_type_written)]
pub was_written: Option<()>,
pub was_written: bool,
pub path: PathBuf,
}
@ -245,7 +245,7 @@ pub struct AmbiguousReturn<'a> {
#[subdiagnostic]
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
#[note(trait_selection_full_type_written)]
pub was_written: Option<()>,
pub was_written: bool,
pub path: PathBuf,
}