Skip to content

Commit d456161

Browse files
authored
Merge pull request #2966 from topecongiro/issue-2953
Format in-place expression like assignment
2 parents 454a20a + 78a0cde commit d456161

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/expr.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,10 @@ pub fn format_expr(
338338
))
339339
}
340340
}
341-
// FIXME(#2743)
342-
ast::ExprKind::ObsoleteInPlace(..) => unimplemented!(),
341+
ast::ExprKind::ObsoleteInPlace(ref lhs, ref rhs) => lhs
342+
.rewrite(context, shape)
343+
.map(|s| s + " <-")
344+
.and_then(|lhs| rewrite_assign_rhs(context, lhs, &**rhs, shape)),
343345
ast::ExprKind::Async(capture_by, _node_id, ref block) => {
344346
let mover = if capture_by == ast::CaptureBy::Value {
345347
"move "

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(tool_attributes)]
1211
#![feature(decl_macro)]
1312
#![allow(unused_attributes)]
1413
#![feature(type_ascription)]

tests/target/obsolete_in_place.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// #2953
2+
3+
macro_rules! demo {
4+
($a:ident <- $b:expr) => {};
5+
}
6+
7+
fn main() {
8+
demo!(i <- 0);
9+
}

0 commit comments

Comments
 (0)