Enum clippy_lints::utils::sugg::Sugg [] [src]

pub enum Sugg<'a> {
    NonParen(Cow<'a, str>),
    MaybeParen(Cow<'a, str>),
    BinOp(AssocOpCow<'a, str>),
}

A helper type to build suggestion correctly handling parenthesis.

Variants

An expression that never needs parenthesis such as 1337 or [0; 42].

An expression that does not fit in other variants.

A binary operator expression, including as-casts and explicit type coercion.

Methods

impl<'a> Sugg<'a>
[src]

Prepare a suggestion from an expression.

Convenience function around hir_opt for suggestions with a default text.

Prepare a suggestion from an expression.

Convenience method to create the <lhs> && <rhs> suggestion.

Convenience method to create the <lhs> as <rhs> suggestion.

Convenience method to create the &<expr> suggestion.

Convenience method to create the &mut <expr> suggestion.

Convenience method to create the *<expr> suggestion.

Convenience method to create the <lhs>..<rhs> or <lhs>...<rhs> suggestion.

Add parenthesis to any expression that might need them. Suitable to the self argument of a method call (eg. to build bar.foo() or (1 + 2).foo()).

Trait Implementations

impl<'a> Display for Sugg<'a>
[src]

Formats the value using the given formatter.

impl<'a, 'b> Add<Sugg<'b>> for Sugg<'a>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b> Sub<Sugg<'b>> for Sugg<'a>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a> Not for Sugg<'a>
[src]

The resulting type after applying the ! operator

The method for the unary ! operator