Module sugg

Source
Expand description

Contains utility functions to generate suggestions.

Macros§

forward_binop_impls_to_ref πŸ”’
Copied from the rust standard library, and then edited

Structs§

DerefClosure
Suggestion results for handling closure args dereferencing and borrowing
DerefDelegate πŸ”’
Visitor struct used for tracking down dereferencing and borrowing of closure’s args
ParenHelper πŸ”’
Helper type to display either foo or (foo).

Enums§

Associativity πŸ”’
Operator associativity.
Sugg
A helper type to build suggestion correctly handling parentheses.

Constants§

EMPTY
a constant represents an empty string, for convenience.
ONE
Literal constant 1, for convenience.
ZERO
Literal constant 0, for convenience.

Traits§

DiagExt
Convenience extension trait for Diag.

Functions§

associativity πŸ”’
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).
astbinop2assignop πŸ”’
Converts an ast::BinOp to the corresponding assigning binary operator.
binop_to_string πŸ”’
Generates a string from the operator and both sides.
deref_closure_args
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
has_enclosing_paren
Returns true if sugg is enclosed in parenthesis.
hirbinop2assignop πŸ”’
Converts a hir::BinOp to the corresponding assigning binary operator.
indentation πŸ”’
Returns the indentation before span if there are nothing but [ \t] before it on its line.
make_assoc
Builds the string for <lhs> <op> <rhs> adding parenthesis when necessary.
make_binop
Convenience wrapper around make_assoc and AssocOp::from_ast_binop.
make_unop
Builds the string for <op><expr> adding parenthesis when necessary.