Check in push_suggestion
This commit is contained in:
parent
87ea0d76fe
commit
4909258ae8
2 changed files with 9 additions and 5 deletions
|
@ -519,6 +519,15 @@ impl Diagnostic {
|
||||||
|
|
||||||
/// Helper for pushing to `self.suggestions`, if available (not disable).
|
/// Helper for pushing to `self.suggestions`, if available (not disable).
|
||||||
fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
|
fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
|
||||||
|
let in_derive = suggestion
|
||||||
|
.substitutions
|
||||||
|
.iter()
|
||||||
|
.any(|subst| subst.parts.iter().any(|part| part.span.in_derive_expansion()));
|
||||||
|
if in_derive {
|
||||||
|
// Ignore if spans is from derive macro.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if let Ok(suggestions) = &mut self.suggestions {
|
if let Ok(suggestions) = &mut self.suggestions {
|
||||||
suggestions.push(suggestion);
|
suggestions.push(suggestion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2698,11 +2698,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if expr.span.in_derive_expansion() {
|
|
||||||
// Ignore if span is from derive macro.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let Ok(src) = self.tcx.sess.source_map().span_to_snippet(expr.span) else {
|
let Ok(src) = self.tcx.sess.source_map().span_to_snippet(expr.span) else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue