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

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)]");

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