Skip to content

Commit 3a87aa5

Browse files
committed
Merge pull request #1022 from kamalmarhubi/update-syntex-syntax
deps: Update syntex_syntax to 0.33
2 parents 0678152 + 120e1a0 commit 3a87aa5

File tree

7 files changed

+22
-24
lines changed

7 files changed

+22
-24
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ regex = "0.1"
2121
term = "0.4"
2222
strings = "0.0.1"
2323
diff = "0.1"
24-
syntex_syntax = "0.32"
24+
syntex_syntax = "0.33"
2525
log = "0.3"
2626
env_logger = "0.3"
2727
getopts = "0.2"

src/expr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,15 @@ impl Rewrite for ast::Stmt {
581581
struct Loop<'a> {
582582
cond: Option<&'a ast::Expr>,
583583
block: &'a ast::Block,
584-
label: Option<ast::Ident>,
584+
label: Option<ast::SpannedIdent>,
585585
pat: Option<&'a ast::Pat>,
586586
keyword: &'a str,
587587
matcher: &'a str,
588588
connector: &'a str,
589589
}
590590

591591
impl<'a> Loop<'a> {
592-
fn new_loop(block: &'a ast::Block, label: Option<ast::Ident>) -> Loop<'a> {
592+
fn new_loop(block: &'a ast::Block, label: Option<ast::SpannedIdent>) -> Loop<'a> {
593593
Loop {
594594
cond: None,
595595
block: block,
@@ -604,7 +604,7 @@ impl<'a> Loop<'a> {
604604
fn new_while(pat: Option<&'a ast::Pat>,
605605
cond: &'a ast::Expr,
606606
block: &'a ast::Block,
607-
label: Option<ast::Ident>)
607+
label: Option<ast::SpannedIdent>)
608608
-> Loop<'a> {
609609
Loop {
610610
cond: Some(cond),
@@ -623,7 +623,7 @@ impl<'a> Loop<'a> {
623623
fn new_for(pat: &'a ast::Pat,
624624
cond: &'a ast::Expr,
625625
block: &'a ast::Block,
626-
label: Option<ast::Ident>)
626+
label: Option<ast::SpannedIdent>)
627627
-> Loop<'a> {
628628
Loop {
629629
cond: Some(cond),
@@ -676,9 +676,9 @@ impl<'a> Rewrite for Loop<'a> {
676676
}
677677
}
678678

679-
fn rewrite_label(label: Option<ast::Ident>) -> String {
679+
fn rewrite_label(label: Option<ast::SpannedIdent>) -> String {
680680
match label {
681-
Some(ident) => format!("{}: ", ident),
681+
Some(ident) => format!("{}: ", ident.node),
682682
None => "".to_owned(),
683683
}
684684
}

src/items.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ impl<'a> FmtVisitor<'a> {
116116
indent,
117117
item.ident,
118118
fn_decl,
119-
None,
120119
generics,
121120
ast::Unsafety::Normal,
122121
ast::Constness::NotConst,
@@ -169,7 +168,6 @@ impl<'a> FmtVisitor<'a> {
169168
indent: Indent,
170169
ident: ast::Ident,
171170
fd: &ast::FnDecl,
172-
explicit_self: Option<&ast::ExplicitSelf>,
173171
generics: &ast::Generics,
174172
unsafety: ast::Unsafety,
175173
constness: ast::Constness,
@@ -189,7 +187,6 @@ impl<'a> FmtVisitor<'a> {
189187
indent,
190188
ident,
191189
fd,
192-
explicit_self,
193190
generics,
194191
unsafety,
195192
constness,
@@ -234,7 +231,6 @@ impl<'a> FmtVisitor<'a> {
234231
indent,
235232
ident,
236233
&sig.decl,
237-
Some(&sig.explicit_self),
238234
&sig.generics,
239235
sig.unsafety,
240236
sig.constness,
@@ -1129,7 +1125,7 @@ fn rewrite_explicit_self(explicit_self: &ast::ExplicitSelf,
11291125
context: &RewriteContext)
11301126
-> Option<String> {
11311127
match explicit_self.node {
1132-
ast::SelfKind::Region(lt, m, _) => {
1128+
ast::SelfKind::Region(lt, m) => {
11331129
let mut_str = format_mutability(m);
11341130
match lt {
11351131
Some(ref l) => {
@@ -1155,7 +1151,6 @@ fn rewrite_explicit_self(explicit_self: &ast::ExplicitSelf,
11551151

11561152
Some(format!("{}self", format_mutability(mutability)))
11571153
}
1158-
_ => None,
11591154
}
11601155
}
11611156

@@ -1229,7 +1224,6 @@ fn rewrite_fn_base(context: &RewriteContext,
12291224
indent: Indent,
12301225
ident: ast::Ident,
12311226
fd: &ast::FnDecl,
1232-
explicit_self: Option<&ast::ExplicitSelf>,
12331227
generics: &ast::Generics,
12341228
unsafety: ast::Unsafety,
12351229
constness: ast::Constness,
@@ -1328,7 +1322,7 @@ fn rewrite_fn_base(context: &RewriteContext,
13281322
span_for_return(&fd.output).lo);
13291323
let arg_str = try_opt!(rewrite_args(context,
13301324
&fd.inputs,
1331-
explicit_self,
1325+
fd.get_self().as_ref(),
13321326
one_line_budget,
13331327
multi_line_budget,
13341328
indent,

src/patterns.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,25 @@ impl Rewrite for Pat {
5959
let prefix = format!("&{}", format_mutability(mutability));
6060
rewrite_unary_prefix(context, &prefix, &**pat, width, offset)
6161
}
62-
PatKind::Tup(ref items) => {
62+
// FIXME(#1021): Handle `..` in tuple / tuple struct patterns (RFC 1492)
63+
PatKind::Tuple(ref items, dotdot_pos) => {
64+
if dotdot_pos.is_some() {
65+
return None;
66+
}
6367
rewrite_tuple(context,
6468
items.iter().map(|x| &**x),
6569
self.span,
6670
width,
6771
offset)
6872
}
6973
PatKind::Path(ref path) => rewrite_path(context, true, None, path, width, offset),
70-
PatKind::TupleStruct(ref path, ref pat_vec) => {
74+
PatKind::TupleStruct(ref path, ref pat_vec, dotdot_pos) => {
7175
let path_str = try_opt!(rewrite_path(context, true, None, path, width, offset));
7276

73-
match *pat_vec {
74-
Some(ref pat_vec) => {
77+
// FIXME(#1021): Handle `..` in tuple / tuple struct patterns (RFC 1492)
78+
match dotdot_pos {
79+
Some(_) => Some(format!("{}(..)", path_str)),
80+
None => {
7581
if pat_vec.is_empty() {
7682
Some(path_str)
7783
} else {
@@ -95,7 +101,6 @@ impl Rewrite for Pat {
95101
context.config))))
96102
}
97103
}
98-
None => Some(format!("{}(..)", path_str)),
99104
}
100105
}
101106
PatKind::Lit(ref expr) => expr.rewrite(context, width, offset),

src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ impl Rewrite for ast::Ty {
588588
}
589589
ast::TyKind::Mac(..) |
590590
ast::TyKind::Typeof(..) => unreachable!(),
591+
ast::TyKind::ImplicitSelf => Some(String::from("")),
591592
}
592593
}
593594
}

src/visitor.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ impl<'a> FmtVisitor<'a> {
142142
self.rewrite_fn(indent,
143143
ident,
144144
fd,
145-
None,
146145
generics,
147146
unsafety,
148147
constness,
@@ -155,7 +154,6 @@ impl<'a> FmtVisitor<'a> {
155154
self.rewrite_fn(indent,
156155
ident,
157156
fd,
158-
Some(&sig.explicit_self),
159157
&sig.generics,
160158
sig.unsafety,
161159
sig.constness,

0 commit comments

Comments
 (0)