Fix some clippy lints.
This commit is contained in:
parent
7b431c77d4
commit
8a80e547c6
4 changed files with 27 additions and 27 deletions
|
@ -414,7 +414,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
/// clone of) the same error.
|
||||
#[inline]
|
||||
pub fn get_error(&self) -> Option<ScanError> {
|
||||
self.error.as_ref().map(std::clone::Clone::clone)
|
||||
self.error.clone()
|
||||
}
|
||||
|
||||
/// Fill `self.buffer` with at least `count` characters.
|
||||
|
@ -746,7 +746,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
/// # Errors
|
||||
/// This function returns an error if one of the key we would stale was required to be a key.
|
||||
fn stale_simple_keys(&mut self) -> ScanResult {
|
||||
for (_, sk) in self.simple_keys.iter_mut().enumerate() {
|
||||
for sk in &mut self.simple_keys {
|
||||
if sk.possible
|
||||
// If not in a flow construct, simple keys cannot span multiple lines.
|
||||
&& self.flow_level == 0
|
||||
|
|
|
@ -352,11 +352,11 @@ fn test_integer_key() {
|
|||
#[test]
|
||||
fn test_indentation_equality() {
|
||||
let four_spaces = YamlLoader::load_from_str(
|
||||
r#"
|
||||
r"
|
||||
hash:
|
||||
with:
|
||||
indentations
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
|
@ -364,11 +364,11 @@ hash:
|
|||
.unwrap();
|
||||
|
||||
let two_spaces = YamlLoader::load_from_str(
|
||||
r#"
|
||||
r"
|
||||
hash:
|
||||
with:
|
||||
indentations
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
|
@ -376,11 +376,11 @@ hash:
|
|||
.unwrap();
|
||||
|
||||
let one_space = YamlLoader::load_from_str(
|
||||
r#"
|
||||
r"
|
||||
hash:
|
||||
with:
|
||||
indentations
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
|
@ -388,11 +388,11 @@ hash:
|
|||
.unwrap();
|
||||
|
||||
let mixed_spaces = YamlLoader::load_from_str(
|
||||
r#"
|
||||
r"
|
||||
hash:
|
||||
with:
|
||||
indentations
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
|
@ -408,7 +408,7 @@ hash:
|
|||
fn test_two_space_indentations() {
|
||||
// https://github.com/kbknapp/clap-rs/issues/965
|
||||
|
||||
let s = r#"
|
||||
let s = r"
|
||||
subcommands:
|
||||
- server:
|
||||
about: server related commands
|
||||
|
@ -418,7 +418,7 @@ subcommands2:
|
|||
subcommands3:
|
||||
- server:
|
||||
about: server related commands
|
||||
"#;
|
||||
";
|
||||
|
||||
let out = YamlLoader::load_from_str(s).unwrap();
|
||||
let doc = &out.into_iter().next().unwrap();
|
||||
|
|
|
@ -36,7 +36,7 @@ a4:
|
|||
|
||||
#[test]
|
||||
fn test_emit_complex() {
|
||||
let s = r#"
|
||||
let s = r"
|
||||
cataloge:
|
||||
product: &coffee { name: Coffee, price: 2.5 , unit: 1l }
|
||||
product: &cookies { name: Cookies!, price: 3.40 , unit: 400g}
|
||||
|
@ -54,7 +54,7 @@ products:
|
|||
bool key
|
||||
{}:
|
||||
empty hash key
|
||||
"#;
|
||||
";
|
||||
let docs = YamlLoader::load_from_str(s).unwrap();
|
||||
let doc = &docs[0];
|
||||
let mut writer = String::new();
|
||||
|
@ -66,8 +66,8 @@ products:
|
|||
Ok(y) => y,
|
||||
Err(e) => panic!("{}", e),
|
||||
};
|
||||
let doc_new = &docs_new[0];
|
||||
assert_eq!(doc, doc_new);
|
||||
let new_doc = &docs_new[0];
|
||||
assert_eq!(doc, new_doc);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -190,7 +190,7 @@ fn test_empty_and_nested_compact() {
|
|||
|
||||
fn test_empty_and_nested_flag(compact: bool) {
|
||||
let s = if compact {
|
||||
r#"---
|
||||
r"---
|
||||
a:
|
||||
b:
|
||||
c: hello
|
||||
|
@ -198,9 +198,9 @@ a:
|
|||
e:
|
||||
- f
|
||||
- g
|
||||
- h: []"#
|
||||
- h: []"
|
||||
} else {
|
||||
r#"---
|
||||
r"---
|
||||
a:
|
||||
b:
|
||||
c: hello
|
||||
|
@ -209,7 +209,7 @@ e:
|
|||
- f
|
||||
- g
|
||||
-
|
||||
h: []"#
|
||||
h: []"
|
||||
};
|
||||
|
||||
let docs = YamlLoader::load_from_str(s).unwrap();
|
||||
|
@ -226,13 +226,13 @@ e:
|
|||
|
||||
#[test]
|
||||
fn test_nested_arrays() {
|
||||
let s = r#"---
|
||||
let s = r"---
|
||||
a:
|
||||
- b
|
||||
- - c
|
||||
- d
|
||||
- - e
|
||||
- f"#;
|
||||
- f";
|
||||
|
||||
let docs = YamlLoader::load_from_str(s).unwrap();
|
||||
let doc = &docs[0];
|
||||
|
@ -249,14 +249,14 @@ a:
|
|||
|
||||
#[test]
|
||||
fn test_deeply_nested_arrays() {
|
||||
let s = r#"---
|
||||
let s = r"---
|
||||
a:
|
||||
- b
|
||||
- - c
|
||||
- d
|
||||
- - e
|
||||
- - f
|
||||
- - e"#;
|
||||
- - e";
|
||||
|
||||
let docs = YamlLoader::load_from_str(s).unwrap();
|
||||
let doc = &docs[0];
|
||||
|
@ -273,12 +273,12 @@ a:
|
|||
|
||||
#[test]
|
||||
fn test_nested_hashes() {
|
||||
let s = r#"---
|
||||
let s = r"---
|
||||
a:
|
||||
b:
|
||||
c:
|
||||
d:
|
||||
e: f"#;
|
||||
e: f";
|
||||
|
||||
let docs = YamlLoader::load_from_str(s).unwrap();
|
||||
let doc = &docs[0];
|
||||
|
|
|
@ -80,7 +80,7 @@ fn load_tests_from_file(entry: &DirEntry) -> Result<Vec<Test<YamlTest>>> {
|
|||
let test_name = file_name
|
||||
.strip_suffix(".yaml")
|
||||
.ok_or("unexpected filename")?;
|
||||
let tests = YamlLoader::load_from_str(&fs::read_to_string(&entry.path())?)?;
|
||||
let tests = YamlLoader::load_from_str(&fs::read_to_string(entry.path())?)?;
|
||||
let tests = tests[0].as_vec().ok_or("no test list found in file")?;
|
||||
|
||||
let mut result = vec![];
|
||||
|
|
Loading…
Reference in a new issue