about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-08 15:13:20 +0000
committerbors <bors@rust-lang.org>2022-08-08 15:13:20 +0000
commit554f7f889e9feecf7d851ae3aaa03d5273563b1f (patch)
tree4c67411d7c7c44fdd05196ec8e7700f259c9e3e2
parent79c22d5fb1f3212714f509bac2f07042e301b19a (diff)
parente39918f553d7dd5fb5afd6517f80d3e35290c4d2 (diff)
Auto merge of #12974 - fprasx:master, r=lnicola
Corrected order of printing op and `=`

Fixes https://github.com/rust-lang/rust-analyzer/issues/12971 where `Display` impl for assignment operators does `=+` instead of `+=`
-rw-r--r--crates/syntax/src/ast/operators.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/syntax/src/ast/operators.rs b/crates/syntax/src/ast/operators.rs
index a687ba0b77a..8f7b3fb6008 100644
--- a/crates/syntax/src/ast/operators.rs
+++ b/crates/syntax/src/ast/operators.rs
@@ -111,10 +111,10 @@ impl fmt::Display for BinaryOp {
             BinaryOp::ArithOp(op) => fmt::Display::fmt(op, f),
             BinaryOp::CmpOp(op) => fmt::Display::fmt(op, f),
             BinaryOp::Assignment { op } => {
-                f.write_str("=")?;
                 if let Some(op) = op {
                     fmt::Display::fmt(op, f)?;
                 }
+                f.write_str("=")?;
                 Ok(())
             }
         }