Expand description
Contains utility functions to generate suggestions.
Macros§
- forward_
binop_ πimpls_ to_ ref - Copied from the rust standard library, and then edited
Structs§
- Deref
Closure - Suggestion results for handling closure args dereferencing and borrowing
- Deref
Delegate π - Visitor struct used for tracking down dereferencing and borrowing of closureβs args
- Paren
Helper π - 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
ifsugg
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
andAssocOp::from_ast_binop
. - make_
unop - Builds the string for
<op><expr>
adding parenthesis when necessary.