1
Fork 0

Inline WhereClause into Generics.

This commit is contained in:
Camille GILLOT 2022-02-05 15:48:02 +01:00
parent 71b4e2d852
commit 05b29f9a92
24 changed files with 98 additions and 139 deletions

View file

@ -2543,11 +2543,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let pred = format!("{}: {}", bound_kind, sub);
let suggestion = format!(
"{} {}",
if !generics.where_clause.predicates.is_empty() { "," } else { " where" },
if !generics.predicates.is_empty() { "," } else { " where" },
pred,
);
err.span_suggestion(
generics.where_clause.tail_span_for_suggestion(),
generics.tail_span_for_predicate_suggestion(),
"consider adding a where clause",
suggestion,
Applicability::MaybeIncorrect,

View file

@ -372,8 +372,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
.hir()
.get_generics(impl_item_def_id)
.unwrap()
.where_clause
.tail_span_for_suggestion();
.where_clause_span
.shrink_to_hi();
let suggestion = format!(
"{} {}",