don't add redundant help for object safety violations
This commit is contained in:
parent
4fd68eb47b
commit
af6b84aaab
4 changed files with 75 additions and 35 deletions
|
@ -104,9 +104,15 @@ pub fn report_object_safety_error<'tcx>(
|
|||
if trait_span.is_some() {
|
||||
let mut reported_violations: Vec<_> = reported_violations.into_iter().collect();
|
||||
reported_violations.sort();
|
||||
for violation in reported_violations {
|
||||
// Only provide the help if its a local trait, otherwise it's not actionable.
|
||||
violation.solution(&mut err);
|
||||
|
||||
// Only provide the help if its a local trait, otherwise it's not actionable.
|
||||
let mut potential_solutions: Vec<_> =
|
||||
reported_violations.into_iter().map(|violation| violation.solution()).collect();
|
||||
potential_solutions.sort();
|
||||
// Allows us to skip suggesting that the same item should be moved to another trait multiple times.
|
||||
potential_solutions.dedup();
|
||||
for solution in potential_solutions {
|
||||
solution.add_to(&mut err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue