Fix clippy complaints

This commit is contained in:
David Tolnay 2017-05-08 11:35:53 -07:00
parent 70795865c9
commit 37dc15badb
4 changed files with 10 additions and 8 deletions

View file

@ -12,13 +12,13 @@ fn print_indent(indent: usize) {
}
fn dump_node(doc: &yaml::Yaml, indent: usize) {
match doc {
&yaml::Yaml::Array(ref v) => {
match *doc {
yaml::Yaml::Array(ref v) => {
for x in v {
dump_node(x, indent + 1);
}
},
&yaml::Yaml::Hash(ref h) => {
yaml::Yaml::Hash(ref h) => {
for (k, v) in h {
print_indent(indent);
println!("{:?}:", k);

View file

@ -1,6 +1,6 @@
use std::fmt;
use std::convert::From;
use yaml::{Array, Hash, Yaml};
use yaml::{Hash, Yaml};
#[derive(Copy, Clone, Debug)]
pub enum EmitError {
@ -193,7 +193,7 @@ impl<'a> YamlEmitter<'a> {
}
}
fn emit_array(&mut self, v: &Array) -> EmitResult {
fn emit_array(&mut self, v: &[Yaml]) -> EmitResult {
if v.is_empty() {
try!(write!(self.writer, "[]"));
} else {

View file

@ -11,11 +11,11 @@ quickcheck! {
let mut out_str = String::new();
{
let mut emitter = YamlEmitter::new(&mut out_str);
emitter.dump(&Yaml::Array(xs.into_iter().map(|s| Yaml::String(s)).collect())).unwrap();
emitter.dump(&Yaml::Array(xs.into_iter().map(Yaml::String).collect())).unwrap();
}
if let Err(err) = YamlLoader::load_from_str(&out_str) {
return TestResult::error(err.description());
}
return TestResult::passed();
TestResult::passed()
}
}
}

View file

@ -5,6 +5,8 @@ extern crate yaml_rust;
use yaml_rust::parser::{Parser, EventReceiver, Event};
use yaml_rust::scanner::TScalarStyle;
// These names match the names used in the C++ test suite.
#[cfg_attr(feature = "cargo-clippy", allow(enum_variant_names))]
#[derive(Clone, PartialEq, PartialOrd, Debug)]
enum TestEvent {
OnDocumentStart,