Upgrade to rustfmt 0.6.3

This commit is contained in:
Jakob Stoklund Olesen
2016-12-21 10:05:14 -08:00
parent 3568b93b84
commit 893a630ca0
3 changed files with 32 additions and 26 deletions

View File

@@ -165,9 +165,9 @@ impl Pattern {
let refname = s[refname_begin..refname_end].to_string(); let refname = s[refname_begin..refname_end].to_string();
return if let Some(defidx) = def { return if let Some(defidx) = def {
Ok((Part::DefVar { Ok((Part::DefVar {
def: defidx, def: defidx,
var: refname, var: refname,
}, },
refname_end + 1)) refname_end + 1))
} else { } else {
Err(Error::Syntax(format!("expected variable name in $(=${})", refname))) Err(Error::Syntax(format!("expected variable name in $(=${})", refname)))
@@ -462,37 +462,37 @@ mod tests {
assert_eq!(pat.parse_part("$(foo=$bar)").unwrap(), assert_eq!(pat.parse_part("$(foo=$bar)").unwrap(),
(Part::DefVar { (Part::DefVar {
def: 0, def: 0,
var: "bar".to_string(), var: "bar".to_string(),
}, },
11)); 11));
assert_eq!(pat.parse_part("$(foo=$bar)").unwrap_err().to_string(), assert_eq!(pat.parse_part("$(foo=$bar)").unwrap_err().to_string(),
"duplicate definition of $foo in same pattern"); "duplicate definition of $foo in same pattern");
assert_eq!(pat.parse_part("$(fxo=$bar)x").unwrap(), assert_eq!(pat.parse_part("$(fxo=$bar)x").unwrap(),
(Part::DefVar { (Part::DefVar {
def: 1, def: 1,
var: "bar".to_string(), var: "bar".to_string(),
}, },
11)); 11));
assert_eq!(pat.parse_part("$(fo2=[a-z])").unwrap(), assert_eq!(pat.parse_part("$(fo2=[a-z])").unwrap(),
(Part::DefLit { (Part::DefLit {
def: 2, def: 2,
regex: "(?P<fo2>[a-z])".to_string(), regex: "(?P<fo2>[a-z])".to_string(),
}, },
12)); 12));
assert_eq!(pat.parse_part("$(fo3=[a-)])").unwrap(), assert_eq!(pat.parse_part("$(fo3=[a-)])").unwrap(),
(Part::DefLit { (Part::DefLit {
def: 3, def: 3,
regex: "(?P<fo3>[a-)])".to_string(), regex: "(?P<fo3>[a-)])".to_string(),
}, },
12)); 12));
assert_eq!(pat.parse_part("$(fo4=)").unwrap(), assert_eq!(pat.parse_part("$(fo4=)").unwrap(),
(Part::DefLit { (Part::DefLit {
def: 4, def: 4,
regex: "(?P<fo4>)".to_string(), regex: "(?P<fo4>)".to_string(),
}, },
7)); 7));
assert_eq!(pat.parse_part("$(=.*)").unwrap(), assert_eq!(pat.parse_part("$(=.*)").unwrap(),

View File

@@ -30,7 +30,7 @@ function banner() {
# rustfmt is installed. # rustfmt is installed.
# #
# This version should always be bumped to the newest version available. # This version should always be bumped to the newest version available.
RUSTFMT_VERSION="0.6.2" RUSTFMT_VERSION="0.6.3"
if cargo install --list | grep -q "^rustfmt v$RUSTFMT_VERSION"; then if cargo install --list | grep -q "^rustfmt v$RUSTFMT_VERSION"; then
banner "Rust formatting" banner "Rust formatting"

View File

@@ -9,8 +9,9 @@ use self::cretonne::entity_map::EntityMap;
fn test_reverse_postorder_traversal(function_source: &str, ebb_order: Vec<u32>) { fn test_reverse_postorder_traversal(function_source: &str, ebb_order: Vec<u32>) {
let func = &parse_functions(function_source).unwrap()[0]; let func = &parse_functions(function_source).unwrap()[0];
let cfg = ControlFlowGraph::new(&func); let cfg = ControlFlowGraph::new(&func);
let ebbs = ebb_order.iter().map(|n| Ebb::with_number(*n).unwrap()) let ebbs = ebb_order.iter()
.collect::<Vec<Ebb>>(); .map(|n| Ebb::with_number(*n).unwrap())
.collect::<Vec<Ebb>>();
let mut postorder_ebbs = cfg.postorder_ebbs(); let mut postorder_ebbs = cfg.postorder_ebbs();
let mut postorder_map = EntityMap::with_capacity(postorder_ebbs.len()); let mut postorder_map = EntityMap::with_capacity(postorder_ebbs.len());
@@ -50,7 +51,8 @@ fn simple_traversal() {
ebb5: ebb5:
trap trap
} }
", vec![0, 2, 1, 3, 4, 5]); ",
vec![0, 2, 1, 3, 4, 5]);
} }
#[test] #[test]
@@ -67,7 +69,8 @@ fn loops_one() {
ebb3: ebb3:
return return
} }
", vec![0, 1, 2, 3]); ",
vec![0, 1, 2, 3]);
} }
#[test] #[test]
@@ -91,7 +94,8 @@ fn loops_two() {
brz v0, ebb4 brz v0, ebb4
return return
} }
", vec![0, 1, 2, 5, 4, 3]); ",
vec![0, 1, 2, 5, 4, 3]);
} }
#[test] #[test]
@@ -120,7 +124,8 @@ fn loops_three() {
ebb7: ebb7:
return return
} }
", vec![0, 1, 2, 5, 4, 3, 6, 7]); ",
vec![0, 1, 2, 5, 4, 3, 6, 7]);
} }
#[test] #[test]
@@ -142,5 +147,6 @@ fn back_edge_one() {
ebb4: ebb4:
trap trap
} }
", vec![0, 1, 3, 2, 4]); ",
vec![0, 1, 3, 2, 4]);
} }