mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 11:12:43 +00:00
Add a missing trailing comma before elipses
This commit is contained in:
parent
88250c4af2
commit
4aa64674c9
@ -13,8 +13,9 @@ use codemap::SpanUtils;
|
||||
use config::{IndentStyle, MultilineStyle};
|
||||
use rewrite::{Rewrite, RewriteContext};
|
||||
use utils::{wrap_str, format_mutability};
|
||||
use lists::{DefinitiveListTactic, format_item_list, itemize_list, ListItem, struct_lit_shape,
|
||||
struct_lit_tactic, shape_for_tactic, struct_lit_formatting, write_list};
|
||||
use lists::{DefinitiveListTactic, SeparatorTactic, format_item_list, itemize_list, ListItem,
|
||||
struct_lit_shape, struct_lit_tactic, shape_for_tactic, struct_lit_formatting,
|
||||
write_list};
|
||||
use expr::{rewrite_unary_prefix, rewrite_pair};
|
||||
use types::{rewrite_path, PathContext};
|
||||
use super::Spanned;
|
||||
@ -134,6 +135,7 @@ fn rewrite_struct_pat(path: &ast::Path,
|
||||
context: &RewriteContext,
|
||||
shape: Shape)
|
||||
-> Option<String> {
|
||||
// 2 = ` {`
|
||||
let path_shape = try_opt!(shape.sub_width(2));
|
||||
let path_str = try_opt!(rewrite_path(context, PathContext::Expr, None, path, path_shape));
|
||||
|
||||
@ -165,6 +167,10 @@ fn rewrite_struct_pat(path: &ast::Path,
|
||||
|
||||
if elipses {
|
||||
if fields_str.contains('\n') {
|
||||
// Add a missing trailing comma.
|
||||
if fmt.trailing_separator == SeparatorTactic::Never {
|
||||
fields_str.push_str(",");
|
||||
}
|
||||
fields_str.push_str("\n");
|
||||
fields_str.push_str(&nested_shape.indent.to_string(context.config));
|
||||
fields_str.push_str("..");
|
||||
|
@ -4,4 +4,10 @@
|
||||
fn main() {
|
||||
let Lorem { ipsum, dolor, sit, } = amet;
|
||||
let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit;
|
||||
|
||||
// #1544
|
||||
if let VrMsg::ClientReply {request_num: reply_req_num, value, ..} = msg {
|
||||
let _ = safe_assert_eq!(reply_req_num, request_num, op);
|
||||
return Ok((request_num, op, value));
|
||||
}
|
||||
}
|
||||
|
@ -11,4 +11,14 @@ fn main() {
|
||||
consectetur,
|
||||
adipiscing
|
||||
} = elit;
|
||||
|
||||
// #1544
|
||||
if let VrMsg::ClientReply {
|
||||
request_num: reply_req_num,
|
||||
value,
|
||||
..
|
||||
} = msg {
|
||||
let _ = safe_assert_eq!(reply_req_num, request_num, op);
|
||||
return Ok((request_num, op, value));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user