Merge pull request #1022 from kamalmarhubi/update-syntex-syntax

deps: Update syntex_syntax to 0.33
This commit is contained in:
Nick Cameron 2016-05-31 01:25:09 +12:00
commit 3a87aa5318
7 changed files with 22 additions and 24 deletions

4
Cargo.lock generated
View File

@ -10,7 +10,7 @@ dependencies = [
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -112,7 +112,7 @@ dependencies = [
[[package]] [[package]]
name = "syntex_syntax" name = "syntex_syntax"
version = "0.32.0" version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -21,7 +21,7 @@ regex = "0.1"
term = "0.4" term = "0.4"
strings = "0.0.1" strings = "0.0.1"
diff = "0.1" diff = "0.1"
syntex_syntax = "0.32" syntex_syntax = "0.33"
log = "0.3" log = "0.3"
env_logger = "0.3" env_logger = "0.3"
getopts = "0.2" getopts = "0.2"

View File

@ -581,7 +581,7 @@ impl Rewrite for ast::Stmt {
struct Loop<'a> { struct Loop<'a> {
cond: Option<&'a ast::Expr>, cond: Option<&'a ast::Expr>,
block: &'a ast::Block, block: &'a ast::Block,
label: Option<ast::Ident>, label: Option<ast::SpannedIdent>,
pat: Option<&'a ast::Pat>, pat: Option<&'a ast::Pat>,
keyword: &'a str, keyword: &'a str,
matcher: &'a str, matcher: &'a str,
@ -589,7 +589,7 @@ struct Loop<'a> {
} }
impl<'a> Loop<'a> { impl<'a> Loop<'a> {
fn new_loop(block: &'a ast::Block, label: Option<ast::Ident>) -> Loop<'a> { fn new_loop(block: &'a ast::Block, label: Option<ast::SpannedIdent>) -> Loop<'a> {
Loop { Loop {
cond: None, cond: None,
block: block, block: block,
@ -604,7 +604,7 @@ impl<'a> Loop<'a> {
fn new_while(pat: Option<&'a ast::Pat>, fn new_while(pat: Option<&'a ast::Pat>,
cond: &'a ast::Expr, cond: &'a ast::Expr,
block: &'a ast::Block, block: &'a ast::Block,
label: Option<ast::Ident>) label: Option<ast::SpannedIdent>)
-> Loop<'a> { -> Loop<'a> {
Loop { Loop {
cond: Some(cond), cond: Some(cond),
@ -623,7 +623,7 @@ impl<'a> Loop<'a> {
fn new_for(pat: &'a ast::Pat, fn new_for(pat: &'a ast::Pat,
cond: &'a ast::Expr, cond: &'a ast::Expr,
block: &'a ast::Block, block: &'a ast::Block,
label: Option<ast::Ident>) label: Option<ast::SpannedIdent>)
-> Loop<'a> { -> Loop<'a> {
Loop { Loop {
cond: Some(cond), cond: Some(cond),
@ -676,9 +676,9 @@ impl<'a> Rewrite for Loop<'a> {
} }
} }
fn rewrite_label(label: Option<ast::Ident>) -> String { fn rewrite_label(label: Option<ast::SpannedIdent>) -> String {
match label { match label {
Some(ident) => format!("{}: ", ident), Some(ident) => format!("{}: ", ident.node),
None => "".to_owned(), None => "".to_owned(),
} }
} }

View File

@ -116,7 +116,6 @@ impl<'a> FmtVisitor<'a> {
indent, indent,
item.ident, item.ident,
fn_decl, fn_decl,
None,
generics, generics,
ast::Unsafety::Normal, ast::Unsafety::Normal,
ast::Constness::NotConst, ast::Constness::NotConst,
@ -169,7 +168,6 @@ impl<'a> FmtVisitor<'a> {
indent: Indent, indent: Indent,
ident: ast::Ident, ident: ast::Ident,
fd: &ast::FnDecl, fd: &ast::FnDecl,
explicit_self: Option<&ast::ExplicitSelf>,
generics: &ast::Generics, generics: &ast::Generics,
unsafety: ast::Unsafety, unsafety: ast::Unsafety,
constness: ast::Constness, constness: ast::Constness,
@ -189,7 +187,6 @@ impl<'a> FmtVisitor<'a> {
indent, indent,
ident, ident,
fd, fd,
explicit_self,
generics, generics,
unsafety, unsafety,
constness, constness,
@ -234,7 +231,6 @@ impl<'a> FmtVisitor<'a> {
indent, indent,
ident, ident,
&sig.decl, &sig.decl,
Some(&sig.explicit_self),
&sig.generics, &sig.generics,
sig.unsafety, sig.unsafety,
sig.constness, sig.constness,
@ -1129,7 +1125,7 @@ fn rewrite_explicit_self(explicit_self: &ast::ExplicitSelf,
context: &RewriteContext) context: &RewriteContext)
-> Option<String> { -> Option<String> {
match explicit_self.node { match explicit_self.node {
ast::SelfKind::Region(lt, m, _) => { ast::SelfKind::Region(lt, m) => {
let mut_str = format_mutability(m); let mut_str = format_mutability(m);
match lt { match lt {
Some(ref l) => { Some(ref l) => {
@ -1155,7 +1151,6 @@ fn rewrite_explicit_self(explicit_self: &ast::ExplicitSelf,
Some(format!("{}self", format_mutability(mutability))) Some(format!("{}self", format_mutability(mutability)))
} }
_ => None,
} }
} }
@ -1229,7 +1224,6 @@ fn rewrite_fn_base(context: &RewriteContext,
indent: Indent, indent: Indent,
ident: ast::Ident, ident: ast::Ident,
fd: &ast::FnDecl, fd: &ast::FnDecl,
explicit_self: Option<&ast::ExplicitSelf>,
generics: &ast::Generics, generics: &ast::Generics,
unsafety: ast::Unsafety, unsafety: ast::Unsafety,
constness: ast::Constness, constness: ast::Constness,
@ -1328,7 +1322,7 @@ fn rewrite_fn_base(context: &RewriteContext,
span_for_return(&fd.output).lo); span_for_return(&fd.output).lo);
let arg_str = try_opt!(rewrite_args(context, let arg_str = try_opt!(rewrite_args(context,
&fd.inputs, &fd.inputs,
explicit_self, fd.get_self().as_ref(),
one_line_budget, one_line_budget,
multi_line_budget, multi_line_budget,
indent, indent,

View File

@ -59,7 +59,11 @@ impl Rewrite for Pat {
let prefix = format!("&{}", format_mutability(mutability)); let prefix = format!("&{}", format_mutability(mutability));
rewrite_unary_prefix(context, &prefix, &**pat, width, offset) rewrite_unary_prefix(context, &prefix, &**pat, width, offset)
} }
PatKind::Tup(ref items) => { // FIXME(#1021): Handle `..` in tuple / tuple struct patterns (RFC 1492)
PatKind::Tuple(ref items, dotdot_pos) => {
if dotdot_pos.is_some() {
return None;
}
rewrite_tuple(context, rewrite_tuple(context,
items.iter().map(|x| &**x), items.iter().map(|x| &**x),
self.span, self.span,
@ -67,11 +71,13 @@ impl Rewrite for Pat {
offset) offset)
} }
PatKind::Path(ref path) => rewrite_path(context, true, None, path, width, offset), PatKind::Path(ref path) => rewrite_path(context, true, None, path, width, offset),
PatKind::TupleStruct(ref path, ref pat_vec) => { PatKind::TupleStruct(ref path, ref pat_vec, dotdot_pos) => {
let path_str = try_opt!(rewrite_path(context, true, None, path, width, offset)); let path_str = try_opt!(rewrite_path(context, true, None, path, width, offset));
match *pat_vec { // FIXME(#1021): Handle `..` in tuple / tuple struct patterns (RFC 1492)
Some(ref pat_vec) => { match dotdot_pos {
Some(_) => Some(format!("{}(..)", path_str)),
None => {
if pat_vec.is_empty() { if pat_vec.is_empty() {
Some(path_str) Some(path_str)
} else { } else {
@ -95,7 +101,6 @@ impl Rewrite for Pat {
context.config)))) context.config))))
} }
} }
None => Some(format!("{}(..)", path_str)),
} }
} }
PatKind::Lit(ref expr) => expr.rewrite(context, width, offset), PatKind::Lit(ref expr) => expr.rewrite(context, width, offset),

View File

@ -588,6 +588,7 @@ impl Rewrite for ast::Ty {
} }
ast::TyKind::Mac(..) | ast::TyKind::Mac(..) |
ast::TyKind::Typeof(..) => unreachable!(), ast::TyKind::Typeof(..) => unreachable!(),
ast::TyKind::ImplicitSelf => Some(String::from("")),
} }
} }
} }

View File

@ -142,7 +142,6 @@ impl<'a> FmtVisitor<'a> {
self.rewrite_fn(indent, self.rewrite_fn(indent,
ident, ident,
fd, fd,
None,
generics, generics,
unsafety, unsafety,
constness, constness,
@ -155,7 +154,6 @@ impl<'a> FmtVisitor<'a> {
self.rewrite_fn(indent, self.rewrite_fn(indent,
ident, ident,
fd, fd,
Some(&sig.explicit_self),
&sig.generics, &sig.generics,
sig.unsafety, sig.unsafety,
sig.constness, sig.constness,