Skip to main content

suggest_to_remove_or_use_generic

Function suggest_to_remove_or_use_generic 

Source
pub(crate) fn suggest_to_remove_or_use_generic(
    tcx: TyCtxt<'_>,
    diag: &mut Diag<'_>,
    impl_def_id: LocalDefId,
    param: &GenericParamDef,
    is_lifetime: bool,
)
Expand description

Adds a suggestion to a diagnostic to either remove an unused generic parameter, or use it.

ยงExamples

  • impl<T> Struct { ... } where T is unused -> suggests removing T or using it.
  • impl<T> Struct { // T used in here } where T is used in the body but not in the self type -> suggests adding T to the self type and struct definition.
  • impl<T> Struct { ... } where the struct has a generic parameter with a default -> suggests adding T to the self type.