Merge pull request #116 from thibaultdelor/StableRustfmt

Format using rustfmt 1.0
This commit is contained in:
Chen Yuheng 2019-03-03 13:44:07 +08:00 committed by GitHub
commit 68f119a62c
5 changed files with 27 additions and 18 deletions

View file

@ -7,7 +7,7 @@ matrix:
- rust: nightly - rust: nightly
- rust: 1.17.0 - rust: 1.17.0
script: cargo build script: cargo build
- rust: 1.22.1 - rust: 1.24.1
- rust: nightly - rust: nightly
env: CLIPPY env: CLIPPY
script: | script: |

View file

@ -1,6 +1,6 @@
install: install:
- ps: Start-FileDownload 'https://static.rust-lang.org/dist/rust-1.22.1-i686-pc-windows-gnu.exe' - ps: Start-FileDownload 'https://static.rust-lang.org/dist/rust-1.24.1-i686-pc-windows-gnu.exe'
- rust-1.22.1-i686-pc-windows-gnu.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" - rust-1.24.1-i686-pc-windows-gnu.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
- SET PATH=%PATH%;C:\MinGW\bin - SET PATH=%PATH%;C:\MinGW\bin
- rustc -V - rustc -V

View file

@ -334,7 +334,7 @@ fn need_quotes(string: &str) -> bool {
// http://yaml.org/type/null.html // http://yaml.org/type/null.html
"null", "Null", "NULL", "~", "null", "Null", "NULL", "~",
] ]
.contains(&string) .contains(&string)
|| string.starts_with('.') || string.starts_with('.')
|| string.parse::<i64>().is_ok() || string.parse::<i64>().is_ok()
|| string.parse::<f64>().is_ok() || string.parse::<f64>().is_ok()

View file

@ -483,10 +483,12 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.allow_simple_key(); self.allow_simple_key();
} }
} }
'#' => while !is_breakz(self.ch()) { '#' => {
self.skip(); while !is_breakz(self.ch()) {
self.lookahead(1); self.skip();
}, self.lookahead(1);
}
}
_ => break, _ => break,
} }
} }
@ -929,11 +931,13 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.lookahead(1); self.lookahead(1);
} }
if string.is_empty() || match self.ch() { if string.is_empty()
c if is_blankz(c) => false, || match self.ch() {
'?' | ':' | ',' | ']' | '}' | '%' | '@' | '`' => false, c if is_blankz(c) => false,
_ => true, '?' | ':' | ',' | ']' | '}' | '%' | '@' | '`' => false,
} { _ => true,
}
{
return Err(ScanError::new(start_mark, "while scanning an anchor or alias, did not find expected alphabetic or numeric character")); return Err(ScanError::new(start_mark, "while scanning an anchor or alias, did not find expected alphabetic or numeric character"));
} }

View file

@ -409,7 +409,8 @@ a4:
a5: 'single_quoted' a5: 'single_quoted'
a6: \"double_quoted\" a6: \"double_quoted\"
a7: a7:
".to_owned(); "
.to_owned();
let out = YamlLoader::load_from_str(&s).unwrap(); let out = YamlLoader::load_from_str(&s).unwrap();
let doc = &out[0]; let doc = &out[0];
assert_eq!(doc["a7"].as_str().unwrap(), "你好"); assert_eq!(doc["a7"].as_str().unwrap(), "你好");
@ -652,7 +653,8 @@ hash:
with: with:
indentations indentations
"#, "#,
).unwrap() )
.unwrap()
.into_iter() .into_iter()
.next() .next()
.unwrap(); .unwrap();
@ -663,7 +665,8 @@ hash:
with: with:
indentations indentations
"#, "#,
).unwrap() )
.unwrap()
.into_iter() .into_iter()
.next() .next()
.unwrap(); .unwrap();
@ -674,7 +677,8 @@ hash:
with: with:
indentations indentations
"#, "#,
).unwrap() )
.unwrap()
.into_iter() .into_iter()
.next() .next()
.unwrap(); .unwrap();
@ -685,7 +689,8 @@ hash:
with: with:
indentations indentations
"#, "#,
).unwrap() )
.unwrap()
.into_iter() .into_iter()
.next() .next()
.unwrap(); .unwrap();