commit
0ef88be7cf
10
src/expr.rs
10
src/expr.rs
@ -959,8 +959,14 @@ fn rewrite_struct_lit<'a>(context: &RewriteContext,
|
||||
|item| {
|
||||
match *item {
|
||||
StructLitField::Regular(ref field) => field.span.lo,
|
||||
// 2 = ..
|
||||
StructLitField::Base(ref expr) => expr.span.lo - BytePos(2),
|
||||
StructLitField::Base(ref expr) => {
|
||||
let last_field_hi =
|
||||
fields.last().map_or(span.lo, |field| field.span.hi);
|
||||
let snippet =
|
||||
context.snippet(mk_sp(last_field_hi, expr.span.lo));
|
||||
let pos = snippet.find_uncommented("..").unwrap();
|
||||
last_field_hi + BytePos(pos as u32)
|
||||
}
|
||||
}
|
||||
},
|
||||
|item| {
|
||||
|
@ -53,3 +53,11 @@ fn issue177() {
|
||||
struct Foo<T> { memb: T }
|
||||
let foo = Foo::<i64> { memb: 10 };
|
||||
}
|
||||
|
||||
fn issue201() {
|
||||
let s = S{a:0, .. b};
|
||||
}
|
||||
|
||||
fn issue201_2() {
|
||||
let s = S{a: S2{ .. c}, .. b};
|
||||
}
|
||||
|
@ -71,3 +71,11 @@ fn issue177() {
|
||||
}
|
||||
let foo = Foo::<i64> { memb: 10 };
|
||||
}
|
||||
|
||||
fn issue201() {
|
||||
let s = S { a: 0, ..b };
|
||||
}
|
||||
|
||||
fn issue201_2() {
|
||||
let s = S { a: S2 { ..c }, ..b };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user