Trait clippy_lints::utils::sugg::DiagnosticBuilderExt
[−]
[src]
pub trait DiagnosticBuilderExt<'a, T: LintContext<'a>> { fn suggest_item_with_attr<D: Display + ?Sized>(&mut self,
cx: &T,
item: Span,
msg: &str,
attr: &D); fn suggest_prepend_item(&mut self,
cx: &T,
item: Span,
msg: &str,
new_item: &str); }
Convenience extension trait for DiagnosticBuilder
.
Required Methods
fn suggest_item_with_attr<D: Display + ?Sized>(&mut self,
cx: &T,
item: Span,
msg: &str,
attr: &D)
cx: &T,
item: Span,
msg: &str,
attr: &D)
Suggests to add an attribute to an item.
Correctly handles indentation of the attribute and item.
Example
db.suggest_item_with_attr(cx, item, "#[derive(Default)]");
fn suggest_prepend_item(&mut self,
cx: &T,
item: Span,
msg: &str,
new_item: &str)
cx: &T,
item: Span,
msg: &str,
new_item: &str)
Suggest to add an item before another.
The item should not be indented (expect for inner indentation).
Example
db.suggest_prepend_item(cx, item, "fn foo() { bar(); }");
Implementors
impl<'a, 'b, 'c, T: LintContext<'c>> DiagnosticBuilderExt<'c, T> for DiagnosticBuilder<'b>