diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-28 09:11:03 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-28 09:42:07 +1100 |
| commit | d84d8d26042e4daa81858ac1e86da731c0ff2ec5 (patch) | |
| tree | a2d85d60619c401f061b6bdcdd88d1c21da0d123 /src/expr.rs | |
| parent | 24ce52a1993d8092d62ea652c6020f85e6c1027d (diff) | |
| download | rust-d84d8d26042e4daa81858ac1e86da731c0ff2ec5.tar.gz rust-d84d8d26042e4daa81858ac1e86da731c0ff2ec5.zip | |
Rework `ast::BinOpKind::to_string` and `ast::UnOp::to_string`.
- Rename them both `as_str`, which is the typical name for a function that returns a `&str`. (`to_string` is appropriate for functions returning `String` or maybe `Cow<'a, str>`.) - Change `UnOp::as_str` from an associated function (weird!) to a method. - Avoid needless `self` dereferences.
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/expr.rs b/src/expr.rs index fa941e6146a..60e0e007b1d 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1933,7 +1933,7 @@ fn rewrite_unary_op( shape: Shape, ) -> Option<String> { // For some reason, an UnOp is not spanned like BinOp! - rewrite_unary_prefix(context, ast::UnOp::to_string(op), expr, shape) + rewrite_unary_prefix(context, op.as_str(), expr, shape) } pub(crate) enum RhsAssignKind<'ast> { |
