Merge pull request #1251 from erickt/master
Version bump for dependencies, add support for `break` values
This commit is contained in:
commit
90db34a961
83
Cargo.lock
generated
83
Cargo.lock
generated
@ -5,20 +5,20 @@ dependencies = [
|
||||
"diff 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"multimap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.52.0 (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)",
|
||||
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-segmentation 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"walkdir 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -40,6 +40,11 @@ name = "diff"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.3.5"
|
||||
@ -56,8 +61,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.4.19"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"either 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
@ -70,7 +78,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -83,7 +91,7 @@ name = "memchr"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -110,7 +118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-serialize"
|
||||
version = "0.3.21"
|
||||
version = "0.3.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -123,36 +131,36 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syntex_errors"
|
||||
version = "0.50.0"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_pos"
|
||||
version = "0.50.0"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_syntax"
|
||||
version = "0.50.0"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -172,7 +180,7 @@ version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -185,15 +193,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.1.30"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "0.1.2"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -208,7 +216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "0.1.8"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -229,28 +237,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum diff 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e48977eec6d3b7707462c2dc2e1363ad91b5dd822cf942537ccdc2085dc87587"
|
||||
"checksum either 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2b503c86dad62aaf414ecf2b8c527439abedb3f8d812537f0b12bfd6f32a91"
|
||||
"checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f"
|
||||
"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685"
|
||||
"checksum itertools 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c4a9b56eb56058f43dc66e58f40a214b2ccbc9f3df51861b63d51dec7b65bc3f"
|
||||
"checksum itertools 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c6946da472dbbcbd98c049050e8e587cc4ee26985992e582b1d74a35cb8a7020"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8"
|
||||
"checksum libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a51822fc847e7a8101514d1d44e354ba2ffa7d4c194dcab48870740e327cac70"
|
||||
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
|
||||
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
|
||||
"checksum multimap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9223f4774d08e06185e44e555b9a7561243d387bac49c78a6205c42d6975fbf2"
|
||||
"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
|
||||
"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
|
||||
"checksum rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)" = "bff9fc1c79f2dec76b253273d07682e94a978bd8f132ded071188122b2af9818"
|
||||
"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b"
|
||||
"checksum strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "54f86446ab480b4f60782188f4f78886465c5793aee248cbb48b7fdc0d022420"
|
||||
"checksum syntex_errors 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84822a1178204a191239ad844599f8c85c128cf9f4173397def4eb46b55b0aa1"
|
||||
"checksum syntex_pos 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a43abded5057c75bac8555e46ec913ce502efb418267b1ab8e9783897470c7db"
|
||||
"checksum syntex_syntax 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ef781e4b60f03431f1b5b59843546ce60ae029a787770cf8e0969ac1fd063a5"
|
||||
"checksum syntex_errors 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e52bffe6202cfb67587784cf23e0ec5bf26d331eef4922a16d5c42e12aa1e9b"
|
||||
"checksum syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "955ef4b16af4c468e4680d1497f873ff288f557d338180649e18f915af5e15ac"
|
||||
"checksum syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "76a302e717e348aa372ff577791c3832395650073b8d8432f8b3cb170b34afde"
|
||||
"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a"
|
||||
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
||||
"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
|
||||
"checksum toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "0590d72182e50e879c4da3b11c6488dae18fccb1ae0c7a3eda18e16795844796"
|
||||
"checksum unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b905d0fc2a1f0befd86b0e72e31d1787944efef9d38b9358a9e92a69757f7e3b"
|
||||
"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4"
|
||||
"checksum unicode-segmentation 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70fba625c17936d0b811ccacb19c4e31186c82db42d9b670bcab830b2ddcde08"
|
||||
"checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"
|
||||
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
|
||||
"checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780"
|
||||
"checksum walkdir 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd7c16466ecc507c7cb5988db03e6eab4aaeab89a5c37a29251fcfd3ac9b7afe"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
12
Cargo.toml
12
Cargo.toml
@ -15,23 +15,23 @@ default = ["cargo-fmt"]
|
||||
cargo-fmt = []
|
||||
|
||||
[dependencies]
|
||||
toml = "0.1"
|
||||
toml = "0.2.1"
|
||||
rustc-serialize = "0.3"
|
||||
unicode-segmentation = "0.1"
|
||||
unicode-segmentation = "1.0.0"
|
||||
regex = "0.1"
|
||||
term = "0.4"
|
||||
strings = "0.0.1"
|
||||
diff = "0.1"
|
||||
syntex_syntax = "0.50"
|
||||
syntex_errors = "0.50"
|
||||
syntex_syntax = "0.52"
|
||||
syntex_errors = "0.52"
|
||||
log = "0.3"
|
||||
env_logger = "0.3"
|
||||
getopts = "0.2"
|
||||
itertools = "0.4.15"
|
||||
itertools = "0.5.8"
|
||||
multimap = "0.3"
|
||||
|
||||
[build-dependencies]
|
||||
walkdir = "0.1.5"
|
||||
walkdir = "1.0.3"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2.11"
|
||||
|
19
src/expr.rs
19
src/expr.rs
@ -160,15 +160,24 @@ fn format_expr(expr: &ast::Expr,
|
||||
width,
|
||||
offset)
|
||||
}
|
||||
ast::ExprKind::Break(ref opt_ident) => {
|
||||
ast::ExprKind::Break(ref opt_ident, ref opt_expr) => {
|
||||
let id_str = match *opt_ident {
|
||||
Some(ident) => format!(" {}", ident.node),
|
||||
None => String::new(),
|
||||
};
|
||||
wrap_str(format!("break{}", id_str),
|
||||
context.config.max_width,
|
||||
width,
|
||||
offset)
|
||||
|
||||
if let Some(ref expr) = *opt_expr {
|
||||
rewrite_unary_prefix(context,
|
||||
&format!("break{} ", id_str),
|
||||
&**expr,
|
||||
width,
|
||||
offset)
|
||||
} else {
|
||||
wrap_str(format!("break{}", id_str),
|
||||
context.config.max_width,
|
||||
width,
|
||||
offset)
|
||||
}
|
||||
}
|
||||
ast::ExprKind::Closure(capture, ref fn_decl, ref body, _) => {
|
||||
rewrite_closure(capture, fn_decl, body, expr.span, context, width, offset)
|
||||
|
@ -43,8 +43,8 @@ fn compare_paths(a: &ast::Path, b: &ast::Path) -> Ordering {
|
||||
}
|
||||
|
||||
fn compare_path_list_items(a: &ast::PathListItem, b: &ast::PathListItem) -> Ordering {
|
||||
let a_name_str = a.node.name.name.as_str();
|
||||
let b_name_str = b.node.name.name.as_str();
|
||||
let a_name_str = &*a.node.name.name.as_str();
|
||||
let b_name_str = &*b.node.name.name.as_str();
|
||||
let name_ordering = if a_name_str == "self" {
|
||||
if b_name_str == "self" {
|
||||
Ordering::Equal
|
||||
|
14
src/items.rs
14
src/items.rs
@ -23,9 +23,8 @@ use rewrite::{Rewrite, RewriteContext};
|
||||
use config::{Config, BlockIndentStyle, Density, ReturnIndent, BraceStyle, FnArgLayoutStyle};
|
||||
use itertools::Itertools;
|
||||
|
||||
use syntax::{ast, abi, ptr, codemap};
|
||||
use syntax::{ast, abi, codemap, ptr, symbol};
|
||||
use syntax::codemap::{Span, BytePos, mk_sp};
|
||||
use syntax::parse::token;
|
||||
use syntax::ast::ImplItem;
|
||||
|
||||
// Statements of the form
|
||||
@ -1276,7 +1275,7 @@ pub fn span_hi_for_arg(arg: &ast::Arg) -> BytePos {
|
||||
|
||||
pub fn is_named_arg(arg: &ast::Arg) -> bool {
|
||||
if let ast::PatKind::Ident(_, ident, _) = arg.pat.node {
|
||||
ident.node != token::keywords::Invalid.ident()
|
||||
ident.node != symbol::keywords::Invalid.ident()
|
||||
} else {
|
||||
true
|
||||
}
|
||||
@ -1688,13 +1687,8 @@ fn rewrite_args(context: &RewriteContext,
|
||||
}
|
||||
|
||||
fn arg_has_pattern(arg: &ast::Arg) -> bool {
|
||||
if let ast::PatKind::Ident(_,
|
||||
codemap::Spanned {
|
||||
node: ast::Ident { name: ast::Name(0u32), .. },
|
||||
..
|
||||
},
|
||||
_) = arg.pat.node {
|
||||
false
|
||||
if let ast::PatKind::Ident(_, ident, _) = arg.pat.node {
|
||||
ident.node != symbol::keywords::Invalid.ident()
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
@ -20,9 +20,10 @@
|
||||
// and those with brackets will be formatted as array literals.
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::codemap::{mk_sp, BytePos};
|
||||
use syntax::parse::token::Token;
|
||||
use syntax::parse::tts_to_parser;
|
||||
use syntax::codemap::{mk_sp, BytePos};
|
||||
use syntax::symbol;
|
||||
use syntax::util::ThinVec;
|
||||
|
||||
use Indent;
|
||||
@ -72,11 +73,18 @@ pub fn rewrite_macro(mac: &ast::Mac,
|
||||
}
|
||||
|
||||
let original_style = macro_style(mac, context);
|
||||
|
||||
let macro_name = match extra_ident {
|
||||
None |
|
||||
Some(ast::Ident { name: ast::Name(0), .. }) => format!("{}!", mac.node.path),
|
||||
Some(ident) => format!("{}! {}", mac.node.path, ident),
|
||||
None => format!("{}!", mac.node.path),
|
||||
Some(ident) => {
|
||||
if ident == symbol::keywords::Invalid.ident() {
|
||||
format!("{}!", mac.node.path)
|
||||
} else {
|
||||
format!("{}! {}", mac.node.path, ident)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let style = if FORCED_BRACKET_MACROS.contains(&¯o_name[..]) {
|
||||
MacroStyle::Brackets
|
||||
} else {
|
||||
|
@ -101,9 +101,9 @@ pub fn trimmed_last_line_width(s: &str) -> usize {
|
||||
#[inline]
|
||||
fn is_skip(meta_item: &MetaItem) -> bool {
|
||||
match meta_item.node {
|
||||
MetaItemKind::Word(ref s) => *s == SKIP_ANNOTATION,
|
||||
MetaItemKind::List(ref s, ref l) => {
|
||||
*s == "cfg_attr" && l.len() == 2 && is_skip_nested(&l[1])
|
||||
MetaItemKind::Word => meta_item.name == SKIP_ANNOTATION,
|
||||
MetaItemKind::List(ref l) => {
|
||||
meta_item.name == "cfg_attr" && l.len() == 2 && is_skip_nested(&l[1])
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
@ -119,7 +119,7 @@ fn is_skip_nested(meta_item: &NestedMetaItem) -> bool {
|
||||
|
||||
#[inline]
|
||||
pub fn contains_skip(attrs: &[Attribute]) -> bool {
|
||||
attrs.iter().any(|a| is_skip(&a.node.value))
|
||||
attrs.iter().any(|a| is_skip(&a.value))
|
||||
}
|
||||
|
||||
// Find the end of a TyParam
|
||||
|
@ -471,7 +471,7 @@ impl<'a> FmtVisitor<'a> {
|
||||
}
|
||||
|
||||
let outers: Vec<_> = attrs.iter()
|
||||
.filter(|a| a.node.style == ast::AttrStyle::Outer)
|
||||
.filter(|a| a.style == ast::AttrStyle::Outer)
|
||||
.cloned()
|
||||
.collect();
|
||||
if outers.is_empty() {
|
||||
|
23
tests/source/break-and-continue.rs
Normal file
23
tests/source/break-and-continue.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// break and continue formatting
|
||||
|
||||
#![feature(loop_break_value)]
|
||||
|
||||
fn main() {
|
||||
'a: loop {
|
||||
break 'a;
|
||||
}
|
||||
|
||||
let mut done = false;
|
||||
'b: while !done {
|
||||
done = true;
|
||||
continue 'b;
|
||||
}
|
||||
|
||||
let x = loop {
|
||||
break 5;
|
||||
};
|
||||
|
||||
let x = 'c: loop {
|
||||
break 'c 5;
|
||||
};
|
||||
}
|
23
tests/target/break-and-continue.rs
Normal file
23
tests/target/break-and-continue.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// break and continue formatting
|
||||
|
||||
#![feature(loop_break_value)]
|
||||
|
||||
fn main() {
|
||||
'a: loop {
|
||||
break 'a;
|
||||
}
|
||||
|
||||
let mut done = false;
|
||||
'b: while !done {
|
||||
done = true;
|
||||
continue 'b;
|
||||
}
|
||||
|
||||
let x = loop {
|
||||
break 5;
|
||||
};
|
||||
|
||||
let x = 'c: loop {
|
||||
break 'c 5;
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user