Module clippy_utils::sugg

source ·
Expand description

Contains utility functions to generate suggestions.

Macros§

Structs§

  • Suggestion results for handling closure args dereferencing and borrowing
  • Visitor struct used for tracking down dereferencing and borrowing of closure’s args
  • Helper type to display either foo or (foo).

Enums§

  • Operator associativity.
  • A helper type to build suggestion correctly handling parentheses.

Constants§

  • a constant represents an empty string, for convenience.
  • Literal constant 1, for convenience.
  • Literal constant 0, for convenience.

Traits§

  • Convenience extension trait for Diag.

Functions§

  • Returns the associativity/fixity of an operator. The difference with AssocOp::fixity is that an operator can be both left and right associative (such as +: a + b + c == (a + b) + c == a + (b + c).
  • Converts an ast::BinOp to the corresponding assigning binary operator.
  • Generates a string from the operator and both sides.
  • Build suggestion gradually by handling closure arg specific usages, such as explicit deref and borrowing cases. Returns None if no such use cases have been triggered in closure body
  • Returns true if sugg is enclosed in parenthesis.
  • Converts a hir::BinOp to the corresponding assigning binary operator.
  • Returns the indentation before span if there are nothing but [ \t] before it on its line.
  • Builds the string for <lhs> <op> <rhs> adding parenthesis when necessary.
  • Convenience wrapper around make_assoc and AssocOp::from_ast_binop.
  • Builds the string for <op><expr> adding parenthesis when necessary.