Bug 1510272 - upgraded yaml-rust to 0.4.2; r=ted
authorAlex Gaynor <agaynor@mozilla.com>
Mon, 03 Dec 2018 19:23:36 +0000
changeset 508540 67fb6d9224a1f2debc5fa535c11427cd6911535e
parent 508539 146b5bd178c1f3554aa9dd47854ee84e28e2c6e0
child 508541 9cc51c29fddc5ee0c5d48be361611bce6953e083
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1510272
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1510272 - upgraded yaml-rust to 0.4.2; r=ted This resolves a cargo audit warning in yaml-rust<4.1. Differential Revision: https://phabricator.services.mozilla.com/D13067
Cargo.lock
js/src/frontend/binsource/Cargo.toml
third_party/rust/yaml-rust/.cargo-checksum.json
third_party/rust/yaml-rust/Cargo.toml
third_party/rust/yaml-rust/README.md
third_party/rust/yaml-rust/appveyor.yml
third_party/rust/yaml-rust/examples/dump_yaml.rs
third_party/rust/yaml-rust/src/emitter.rs
third_party/rust/yaml-rust/src/lib.rs
third_party/rust/yaml-rust/src/parser.rs
third_party/rust/yaml-rust/src/scanner.rs
third_party/rust/yaml-rust/src/yaml.rs
third_party/rust/yaml-rust/tests/quickcheck.rs
third_party/rust/yaml-rust/tests/spec_test.rs
third_party/rust/yaml-rust/tests/test_round_trip.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -195,17 +195,17 @@ name = "binast"
 version = "0.1.1"
 dependencies = [
  "binjs_meta 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "webidl 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "bincode"
 version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3091,17 +3091,17 @@ version = "0.1.0"
 dependencies = [
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "yaml-rust"
-version = "0.4.0"
+version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "zip"
 version = "0.4.2"
@@ -3397,10 +3397,10 @@ dependencies = [
 "checksum winapi 0.3.6 (git+https://github.com/froydnj/winapi-rs?branch=aarch64)" = "<none>"
 "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (git+https://github.com/froydnj/winapi-rs?branch=aarch64)" = "<none>"
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (git+https://github.com/froydnj/winapi-rs?branch=aarch64)" = "<none>"
 "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767"
 "checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a"
 "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
 "checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5"
-"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628"
+"checksum yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e"
 "checksum zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36b9e08fb518a65cf7e08a1e482573eb87a2f4f8c6619316612a3c1f162fe822"
--- a/js/src/frontend/binsource/Cargo.toml
+++ b/js/src/frontend/binsource/Cargo.toml
@@ -5,14 +5,14 @@ authors = ["David Teller <D.O.Teller@gma
 autobins = false
 
 [dependencies]
 binjs_meta = "^0.4.3"
 clap = "^2"
 env_logger = "^0.5.6"
 itertools = "^0.7.6"
 log = "0.4"
-yaml-rust = "^0.4"
+yaml-rust = "^0.4.2"
 webidl = "^0.8"
 
 [[bin]]
 name = "binsource"
 path = "src/main.rs"
--- a/third_party/rust/yaml-rust/.cargo-checksum.json
+++ b/third_party/rust/yaml-rust/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"d70c63ea1067f03ea076eb765ac1dc872ef310404266f970c251f2506f43d27d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"70480dc70c2fe1d9bbb64dab9a0abce266332905ffef9cabeae26dd027716ecb","README.md":"3984e447e7c57329054e2f6deb0a4c506f2d5834874d302e8eb1b0f021292db0","appveyor.yml":"a1e941db4a90c6b0e330cd439b49b3316888be28fd3268e69bf9cd88309232cd","examples/dump_yaml.rs":"c2dd4d2db49939b418e8091ad4e9d973540f4ea9acb95e256b6eb780c3816c56","src/emitter.rs":"fc735c05dfcfd5211ac503c4a6adfb4b368a2829e245f2e8e46aa9095d3360fb","src/lib.rs":"f94f1f11d37bffd80a545b3ccba24d1bebc8684c149676a7543fbce639d92076","src/parser.rs":"5f47469edecae8005462d1a80b14fc3e59ae0e947524fb60b1eabb75eb9543f3","src/scanner.rs":"a0b017545dd830d8b97481c3b156685040895ac557b2fc4879b0c4517f2e3723","src/yaml.rs":"6b7409625c1ed7765430e95b181f86fe20e0a52f9ee95f868f09d00cb28dc8b9","tests/quickcheck.rs":"f84169488174b93470df4db0b0e1a5af4f2c1daca397d0f14f02eaaa55da9991","tests/spec_test.rs":"59008e0845bd9ae3a01da5902160f21acbaa4287cf8ae4e26e44b553f0feebc6","tests/spec_test.rs.inc":"544c4d483bbde2401d869c6bf3f2246d3b79fbd13686186acf008f1e19cc86f6","tests/specexamples.rs.inc":"9fa45b9ab96063371878f13f4c3560c560a9c3ba0d71b678265c54523148651c","tests/specs/cpp2rust.rb":"054eca3596adfa59aeec65a15467e41eed472fdcab94900705779cb3376b1c7b","tests/specs/handler_spec_test.cpp":"da8bd253c852ede98e77e8f9196bfaccdae48b77409c3c481b80b6ef56fa40df","tests/specs/libyaml_fail-01.yaml":"c71bced67468f970c195caf605c65fd94009a3be692287a0ad119d9b8e976788","tests/specs/libyaml_fail-02.yaml":"c2e77dd417a474b257651f73f685009d267388be62235d11f195a350a7751ec5","tests/specs/libyaml_fail-03.yaml":"6b0db56f8ce8b2e0ba0a361b86067718a67839b2ce62eb91165ea93f22a9a4a7"},"package":"57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628"}
\ No newline at end of file
+{"files":{"Cargo.toml":"5adbbb13a18a6dcce5077f0eaf9d1c487fcc1e5551cd6b70d2af22858776d349","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"70480dc70c2fe1d9bbb64dab9a0abce266332905ffef9cabeae26dd027716ecb","README.md":"6d44ee744e35bc15b3b97215a78666fbb137e89e26802b28113d11fd52de8795","appveyor.yml":"84647e5326f965627e2fe102efbff852fa9cd7d2d5ccec21d0051045336193e5","examples/dump_yaml.rs":"fb108a4284f094b3addb2c45901ef49edd7fb7ed17bc7316144902030418ef08","src/emitter.rs":"46ea033971f50caf611b6de183b35b72e59a9cfb1d6504968195787e6f87b25a","src/lib.rs":"d6893e5372d9e59e097d0b3018f067d8ffd783b3f7d7b7cf1f2dee12ee0ea572","src/parser.rs":"60c3d4c9b203512b89ce9bf612110b52bd3b0bd6657c368b79546f5ce73aa1a7","src/scanner.rs":"c56a6763d8ecbb7231c9a8ffad027ebf32a02a24d042a20e6914a1a7a6ded666","src/yaml.rs":"cc177b37a28f7e14e02d5e6b470a0f0fc2228285d74678464e3fecfb9a328af5","tests/quickcheck.rs":"d4ec0bb0f4dc4beec82f8922ccacc926ad05912a91a96799b6190c8b8bb8a30e","tests/spec_test.rs":"1b02d189c98b7bfa2774ea49196e90986898e54950be5e48c2431d2c72584486","tests/spec_test.rs.inc":"544c4d483bbde2401d869c6bf3f2246d3b79fbd13686186acf008f1e19cc86f6","tests/specexamples.rs.inc":"9fa45b9ab96063371878f13f4c3560c560a9c3ba0d71b678265c54523148651c","tests/specs/cpp2rust.rb":"054eca3596adfa59aeec65a15467e41eed472fdcab94900705779cb3376b1c7b","tests/specs/handler_spec_test.cpp":"da8bd253c852ede98e77e8f9196bfaccdae48b77409c3c481b80b6ef56fa40df","tests/specs/libyaml_fail-01.yaml":"c71bced67468f970c195caf605c65fd94009a3be692287a0ad119d9b8e976788","tests/specs/libyaml_fail-02.yaml":"c2e77dd417a474b257651f73f685009d267388be62235d11f195a350a7751ec5","tests/specs/libyaml_fail-03.yaml":"6b0db56f8ce8b2e0ba0a361b86067718a67839b2ce62eb91165ea93f22a9a4a7","tests/test_round_trip.rs":"99a6fbedd8fdf0894319a2dd86dad0251007902819bce31cc57b5bc4778d28aa"},"package":"95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e"}
\ No newline at end of file
--- a/third_party/rust/yaml-rust/Cargo.toml
+++ b/third_party/rust/yaml-rust/Cargo.toml
@@ -1,16 +1,26 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "yaml-rust"
-version = "0.4.0"
+version = "0.4.2"
 authors = ["Yuheng Chen <yuhengchen@sensetime.com>"]
+description = "The missing YAML 1.2 parser for rust"
 homepage = "http://chyh1990.github.io/yaml-rust/"
-documentation = "http://chyh1990.github.io/yaml-rust/doc/yaml_rust/"
+documentation = "https://docs.rs/yaml-rust"
+readme = "README.md"
 license = "MIT/Apache-2.0"
-description = "The missing YAML 1.2 parser for rust"
 repository = "https://github.com/chyh1990/yaml-rust"
-# publish = false # this branch contains breaking changes
-
-[dependencies]
-linked-hash-map = ">=0.0.9, <0.6"
-
-[dev-dependencies]
-quickcheck = "0.4"
+[dependencies.linked-hash-map]
+version = ">=0.0.9, <0.6"
+[dev-dependencies.quickcheck]
+version = "0.7"
--- a/third_party/rust/yaml-rust/README.md
+++ b/third_party/rust/yaml-rust/README.md
@@ -1,46 +1,29 @@
 # yaml-rust
 
 The missing YAML 1.2 implementation for Rust.
 
-[![Build Status](https://travis-ci.org/chyh1990/yaml-rust.svg?branch=master)](https://travis-ci.org/chyh1990/yaml-rust)
-[![Build status](https://ci.appveyor.com/api/projects/status/scf47535ckp4ylg4?svg=true)](https://ci.appveyor.com/project/chyh1990/yaml-rust)
-[![license](https://img.shields.io/crates/l/yaml-rust.svg)](https://crates.io/crates/yaml-rust/)
-[![version](https://img.shields.io/crates/v/yaml-rust.svg)](https://crates.io/crates/yaml-rust/)
+[![Travis](https://travis-ci.org/chyh1990/yaml-rust.svg?branch=master)](https://travis-ci.org/chyh1990/yaml-rust)
+[![AppVeyor](https://ci.appveyor.com/api/projects/status/scf47535ckp4ylg4?svg=true)](https://ci.appveyor.com/project/chyh1990/yaml-rust)
+[![crates.io](https://img.shields.io/crates/v/yaml-rust.svg)](https://crates.io/crates/yaml-rust)
+[![docs.rs](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/yaml-rust)
 
 `yaml-rust` is a pure Rust YAML 1.2 implementation,
 which enjoys the memory safety
 property and other benefits from the Rust language.
 The parser is heavily influenced by `libyaml` and `yaml-cpp`.
 
-This crate works on all Rust-supported platforms. It also works on
-Rust 1.0.0 and nightly!
-
-See [Document](http://chyh1990.github.io/yaml-rust/doc/yaml_rust/)
-
-> NOTE: This library is still under heavy development.
-
-> WARNING: This library needs more tests and it is NOT ready for
-> parsing arbitrary user input from *untrusted source*.
-
 ## Quick Start
 
 Add the following to the Cargo.toml of your project:
 
 ```toml
 [dependencies]
-yaml-rust = "0.3"
-```
-
-or
-
-```toml
-[dependencies.yaml-rust]
-git = "https://github.com/chyh1990/yaml-rust.git"
+yaml-rust = "0.4"
 ```
 
 and import:
 
 ```rust
 extern crate yaml_rust;
 ```
 
--- a/third_party/rust/yaml-rust/appveyor.yml
+++ b/third_party/rust/yaml-rust/appveyor.yml
@@ -1,11 +1,11 @@
 install:
-  - ps: Start-FileDownload 'https://static.rust-lang.org/dist/rust-1.16.0-i686-pc-windows-gnu.exe'
-  - rust-1.16.0-i686-pc-windows-gnu.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
+  - ps: Start-FileDownload 'https://static.rust-lang.org/dist/rust-1.22.1-i686-pc-windows-gnu.exe'
+  - rust-1.22.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:\MinGW\bin
   - rustc -V
   - cargo -V
   - git submodule update --init --recursive
 
 build: false
 
--- a/third_party/rust/yaml-rust/examples/dump_yaml.rs
+++ b/third_party/rust/yaml-rust/examples/dump_yaml.rs
@@ -12,24 +12,24 @@ fn print_indent(indent: usize) {
 }
 
 fn dump_node(doc: &yaml::Yaml, indent: usize) {
     match *doc {
         yaml::Yaml::Array(ref v) => {
             for x in v {
                 dump_node(x, indent + 1);
             }
-        },
+        }
         yaml::Yaml::Hash(ref h) => {
             for (k, v) in h {
                 print_indent(indent);
                 println!("{:?}:", k);
                 dump_node(v, indent + 1);
             }
-        },
+        }
         _ => {
             print_indent(indent);
             println!("{:?}", doc);
         }
     }
 }
 
 fn main() {
--- a/third_party/rust/yaml-rust/src/emitter.rs
+++ b/third_party/rust/yaml-rust/src/emitter.rs
@@ -1,18 +1,17 @@
-use std::fmt::{self, Display};
 use std::convert::From;
 use std::error::Error;
+use std::fmt::{self, Display};
 use yaml::{Hash, Yaml};
 
-
 #[derive(Copy, Clone, Debug)]
 pub enum EmitError {
-        FmtError(fmt::Error),
-        BadHashmapKey,
+    FmtError(fmt::Error),
+    BadHashmapKey,
 }
 
 impl Error for EmitError {
     fn description(&self) -> &str {
         match *self {
             EmitError::FmtError(ref err) => err.description(),
             EmitError::BadHashmapKey => "bad hashmap key",
         }
@@ -86,17 +85,17 @@ fn escape_str(wr: &mut fmt::Write, v: &s
             b'\x19' => "\\u0019",
             b'\x1a' => "\\u001a",
             b'\x1b' => "\\u001b",
             b'\x1c' => "\\u001c",
             b'\x1d' => "\\u001d",
             b'\x1e' => "\\u001e",
             b'\x1f' => "\\u001f",
             b'\x7f' => "\\u007f",
-            _ => { continue; }
+            _ => continue,
         };
 
         if start < i {
             try!(wr.write_str(&v[start..i]));
         }
 
         try!(wr.write_str(escaped));
 
@@ -109,93 +108,93 @@ fn escape_str(wr: &mut fmt::Write, v: &s
 
     try!(wr.write_str("\""));
     Ok(())
 }
 
 impl<'a> YamlEmitter<'a> {
     pub fn new(writer: &'a mut fmt::Write) -> YamlEmitter {
         YamlEmitter {
-            writer: writer,
+            writer,
             best_indent: 2,
             compact: true,
-
-            level: -1
+            level: -1,
         }
     }
 
     /// Set 'compact inline notation' on or off, as described for block
     /// [sequences](http://www.yaml.org/spec/1.2/spec.html#id2797382)
     /// and
     /// [mappings](http://www.yaml.org/spec/1.2/spec.html#id2798057).
     ///
     /// In this form, blocks cannot have any properties (such as anchors
     /// or tags), which should be OK, because this emitter doesn't
     /// (currently) emit those anyways.
     pub fn compact(&mut self, compact: bool) {
-      self.compact = compact;
+        self.compact = compact;
     }
 
     /// Determine if this emitter is using 'compact inline notation'.
     pub fn is_compact(&self) -> bool {
-      self.compact
+        self.compact
     }
 
     pub fn dump(&mut self, doc: &Yaml) -> EmitResult {
         // write DocumentStart
         try!(write!(self.writer, "---\n"));
         self.level = -1;
         self.emit_node(doc)
     }
 
     fn write_indent(&mut self) -> EmitResult {
-        if self.level <= 0 { return Ok(()); }
+        if self.level <= 0 {
+            return Ok(());
+        }
         for _ in 0..self.level {
             for _ in 0..self.best_indent {
                 try!(write!(self.writer, " "));
             }
         }
         Ok(())
     }
 
     fn emit_node(&mut self, node: &Yaml) -> EmitResult {
         match *node {
             Yaml::Array(ref v) => self.emit_array(v),
             Yaml::Hash(ref h) => self.emit_hash(h),
             Yaml::String(ref v) => {
                 if need_quotes(v) {
                     try!(escape_str(self.writer, v));
-                }
-                else {
+                } else {
                     try!(write!(self.writer, "{}", v));
                 }
                 Ok(())
-            },
+            }
             Yaml::Boolean(v) => {
                 if v {
                     try!(self.writer.write_str("true"));
                 } else {
                     try!(self.writer.write_str("false"));
                 }
                 Ok(())
-            },
+            }
             Yaml::Integer(v) => {
                 try!(write!(self.writer, "{}", v));
                 Ok(())
-            },
+            }
             Yaml::Real(ref v) => {
                 try!(write!(self.writer, "{}", v));
                 Ok(())
-            },
+            }
             Yaml::Null | Yaml::BadValue => {
                 try!(write!(self.writer, "~"));
                 Ok(())
-            },
+            }
             // XXX(chenyh) Alias
-            _ => { Ok(()) }
+            _ => Ok(()),
         }
     }
 
     fn emit_array(&mut self, v: &[Yaml]) -> EmitResult {
         if v.is_empty() {
             try!(write!(self.writer, "[]"));
         } else {
             self.level += 1;
@@ -214,34 +213,34 @@ impl<'a> YamlEmitter<'a> {
 
     fn emit_hash(&mut self, h: &Hash) -> EmitResult {
         if h.is_empty() {
             try!(self.writer.write_str("{}"));
         } else {
             self.level += 1;
             for (cnt, (k, v)) in h.iter().enumerate() {
                 let complex_key = match *k {
-                  Yaml::Hash(_) | Yaml::Array(_) => true,
-                  _ => false,
+                    Yaml::Hash(_) | Yaml::Array(_) => true,
+                    _ => false,
                 };
                 if cnt > 0 {
                     try!(write!(self.writer, "\n"));
                     try!(self.write_indent());
                 }
                 if complex_key {
-                  try!(write!(self.writer, "?"));
-                  try!(self.emit_val(true, k));
-                  try!(write!(self.writer, "\n"));
-                  try!(self.write_indent());
-                  try!(write!(self.writer, ":"));
-                  try!(self.emit_val(true, v));
+                    try!(write!(self.writer, "?"));
+                    try!(self.emit_val(true, k));
+                    try!(write!(self.writer, "\n"));
+                    try!(self.write_indent());
+                    try!(write!(self.writer, ":"));
+                    try!(self.emit_val(true, v));
                 } else {
-                  try!(self.emit_node(k));
-                  try!(write!(self.writer, ":"));
-                  try!(self.emit_val(false, v));
+                    try!(self.emit_node(k));
+                    try!(write!(self.writer, ":"));
+                    try!(self.emit_val(false, v));
                 }
             }
             self.level -= 1;
         }
         Ok(())
     }
 
     /// Emit a yaml as a hash or array value: i.e., which should appear
@@ -255,72 +254,95 @@ impl<'a> YamlEmitter<'a> {
                     try!(write!(self.writer, " "));
                 } else {
                     try!(write!(self.writer, "\n"));
                     self.level += 1;
                     try!(self.write_indent());
                     self.level -= 1;
                 }
                 self.emit_array(v)
-            },
+            }
             Yaml::Hash(ref h) => {
                 if (inline && self.compact) || h.is_empty() {
                     try!(write!(self.writer, " "));
                 } else {
                     try!(write!(self.writer, "\n"));
                     self.level += 1;
                     try!(self.write_indent());
                     self.level -= 1;
                 }
                 self.emit_hash(h)
-            },
+            }
             _ => {
                 try!(write!(self.writer, " "));
                 self.emit_node(val)
             }
         }
     }
 }
 
 /// Check if the string requires quoting.
+/// Strings starting with any of the following characters must be quoted.
+/// :, &, *, ?, |, -, <, >, =, !, %, @
 /// Strings containing any of the following characters must be quoted.
-/// :, {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, `
+/// {, }, [, ], ,, #, `
 ///
 /// If the string contains any of the following control characters, it must be escaped with double quotes:
 /// \0, \x01, \x02, \x03, \x04, \x05, \x06, \a, \b, \t, \n, \v, \f, \r, \x0e, \x0f, \x10, \x11, \x12, \x13, \x14, \x15, \x16, \x17, \x18, \x19, \x1a, \e, \x1c, \x1d, \x1e, \x1f, \N, \_, \L, \P
 ///
 /// Finally, there are other cases when the strings must be quoted, no matter if you're using single or double quotes:
 /// * When the string is true or false (otherwise, it would be treated as a boolean value);
 /// * When the string is null or ~ (otherwise, it would be considered as a null value);
 /// * When the string looks like a number, such as integers (e.g. 2, 14, etc.), floats (e.g. 2.6, 14.9) and exponential numbers (e.g. 12e7, etc.) (otherwise, it would be treated as a numeric value);
 /// * When the string looks like a date (e.g. 2014-12-31) (otherwise it would be automatically converted into a Unix timestamp).
 fn need_quotes(string: &str) -> bool {
     fn need_quotes_spaces(string: &str) -> bool {
-        string.starts_with(' ')
-            || string.ends_with(' ')
+        string.starts_with(' ') || string.ends_with(' ')
     }
 
     string == ""
-    || need_quotes_spaces(string)
-    || string.contains(|character: char| {
-        match character {
-            ':' | '{' | '}' | '[' | ']' | ',' | '&' | '*' | '#' | '?' | '|' | '-' | '<' | '>' | '=' | '!' | '%' | '@' | '`' | '\"' | '\'' | '\\' | '\0' ... '\x06' | '\t' | '\n' | '\r' | '\x0e' ... '\x1a' | '\x1c' ... '\x1f' => true,
+        || need_quotes_spaces(string)
+        || string.starts_with(|character: char| match character {
+            '&' | '*' | '?' | '|' | '-' | '<' | '>' | '=' | '!' | '%' | '@' => true,
             _ => false,
-        }
-    })
-    || [// http://yaml.org/type/bool.html
-        "y","Y","yes","Yes","YES","n","N","no","No","NO",
-        "True", "TRUE", "true", "False", "FALSE", "false",
-        "on","On","ON","off","Off","OFF",
-        // http://yaml.org/type/null.html
-        "null","Null","NULL", "~"
-    ].contains(&string)
-    || string.starts_with('.')
-    || string.parse::<i64>().is_ok()
-    || string.parse::<f64>().is_ok()
+        })
+        || string.contains(|character: char| match character {
+            ':'
+            | '{'
+            | '}'
+            | '['
+            | ']'
+            | ','
+            | '#'
+            | '`'
+            | '\"'
+            | '\''
+            | '\\'
+            | '\0'...'\x06'
+            | '\t'
+            | '\n'
+            | '\r'
+            | '\x0e'...'\x1a'
+            | '\x1c'...'\x1f' => true,
+            _ => false,
+        })
+        || [
+            // http://yaml.org/type/bool.html
+            // Note: 'y', 'Y', 'n', 'N', is not quoted deliberately, as in libyaml. PyYAML also parse
+            // them as string, not booleans, although it is volating the YAML 1.1 specification.
+            // See https://github.com/dtolnay/serde-yaml/pull/83#discussion_r152628088.
+            "yes", "Yes", "YES", "no", "No", "NO", "True", "TRUE", "true", "False", "FALSE",
+            "false", "on", "On", "ON", "off", "Off", "OFF",
+            // http://yaml.org/type/null.html
+            "null", "Null", "NULL", "~",
+        ]
+            .contains(&string)
+        || string.starts_with('.')
+        || string.parse::<i64>().is_ok()
+        || string.parse::<f64>().is_ok()
 }
 
 #[cfg(test)]
 mod test {
     use super::*;
     use YamlLoader;
 
     #[test]
@@ -333,29 +355,28 @@ a1:
     b2: d
 a2: 4 # i'm comment
 a3: [1, 2, 3]
 a4:
     - [a1, a2]
     - 2
 ";
 
-
         let docs = YamlLoader::load_from_str(&s).unwrap();
         let doc = &docs[0];
         let mut writer = String::new();
         {
             let mut emitter = YamlEmitter::new(&mut writer);
             emitter.dump(doc).unwrap();
         }
         println!("original:\n{}", s);
         println!("emitted:\n{}", writer);
         let docs_new = match YamlLoader::load_from_str(&writer) {
             Ok(y) => y,
-            Err(e) => panic!(format!("{}", e))
+            Err(e) => panic!(format!("{}", e)),
         };
         let doc_new = &docs_new[0];
 
         assert_eq!(doc, doc_new);
     }
 
     #[test]
     fn test_emit_complex() {
@@ -382,55 +403,56 @@ products:
         let doc = &docs[0];
         let mut writer = String::new();
         {
             let mut emitter = YamlEmitter::new(&mut writer);
             emitter.dump(doc).unwrap();
         }
         let docs_new = match YamlLoader::load_from_str(&writer) {
             Ok(y) => y,
-            Err(e) => panic!(format!("{}", e))
+            Err(e) => panic!(format!("{}", e)),
         };
         let doc_new = &docs_new[0];
         assert_eq!(doc, doc_new);
     }
 
     #[test]
     fn test_emit_avoid_quotes() {
         let s = r#"---
 a7: 你好
 boolean: "true"
 boolean2: "false"
-date: "2014-12-31"
+date: 2014-12-31
 empty_string: ""
 empty_string1: " "
 empty_string2: "    a"
 empty_string3: "    a "
 exp: "12e7"
 field: ":"
 field2: "{"
 field3: "\\"
 field4: "\n"
+field5: "can't avoid quote"
 float: "2.6"
 int: "4"
 nullable: "null"
 nullable2: "~"
 products:
   "*coffee":
     amount: 4
   "*cookies":
     amount: 4
   ".milk":
     amount: 1
   "2.4": real key
   "[1,2,3,4]": array key
   "true": bool key
   "{}": empty hash key
 x: test
-"y": "can't avoid quoting here"
+y: avoid quoting here
 z: string with spaces"#;
 
         let docs = YamlLoader::load_from_str(&s).unwrap();
         let doc = &docs[0];
         let mut writer = String::new();
         {
             let mut emitter = YamlEmitter::new(&mut writer);
             emitter.dump(doc).unwrap();
@@ -461,23 +483,23 @@ string4: "~"
 null0: ~
 ? - true
   - false
 : real_bools
 ? - "True"
   - "TRUE"
   - "False"
   - "FALSE"
-  - "y"
-  - "Y"
+  - y
+  - Y
   - "yes"
   - "Yes"
   - "YES"
-  - "n"
-  - "N"
+  - n
+  - N
   - "no"
   - "No"
   - "NO"
   - "on"
   - "On"
   - "ON"
   - "off"
   - "Off"
@@ -489,48 +511,56 @@ bool1: false"#;
         let docs = YamlLoader::load_from_str(&input).unwrap();
         let doc = &docs[0];
         let mut writer = String::new();
         {
             let mut emitter = YamlEmitter::new(&mut writer);
             emitter.dump(doc).unwrap();
         }
 
-        assert_eq!(expected, writer, "actual:\n\n{}\n", writer);
+        assert_eq!(
+            expected, writer,
+            "expected:\n{}\nactual:\n{}\n",
+            expected, writer
+        );
     }
 
     #[test]
     fn test_empty_and_nested() {
-      test_empty_and_nested_flag(false)
+        test_empty_and_nested_flag(false)
     }
 
     #[test]
     fn test_empty_and_nested_compact() {
-      test_empty_and_nested_flag(true)
+        test_empty_and_nested_flag(true)
     }
 
     fn test_empty_and_nested_flag(compact: bool) {
-        let s = if compact { r#"---
+        let s = if compact {
+            r#"---
 a:
   b:
     c: hello
   d: {}
 e:
   - f
   - g
-  - h: []"# } else { r#"---
+  - h: []"#
+        } else {
+            r#"---
 a:
   b:
     c: hello
   d: {}
 e:
   - f
   - g
   -
-    h: []"# };
+    h: []"#
+        };
 
         let docs = YamlLoader::load_from_str(&s).unwrap();
         let doc = &docs[0];
         let mut writer = String::new();
         {
             let mut emitter = YamlEmitter::new(&mut writer);
             emitter.compact(compact);
             emitter.dump(doc).unwrap();
--- a/third_party/rust/yaml-rust/src/lib.rs
+++ b/third_party/rust/yaml-rust/src/lib.rs
@@ -31,40 +31,44 @@
 //! assert_eq!(doc[0].as_i64().unwrap(), 1); // access elements by index
 //!
 //! let mut out_str = String::new();
 //! let mut emitter = YamlEmitter::new(&mut out_str);
 //! emitter.dump(doc).unwrap(); // dump the YAML object to a String
 //!
 //! ```
 
+#![doc(html_root_url = "https://docs.rs/yaml-rust/0.4.2")]
+#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
 #![cfg_attr(feature = "cargo-clippy", warn(cyclomatic_complexity))]
-#![cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
+#![cfg_attr(
+    feature = "cargo-clippy",
+    allow(match_same_arms, should_implement_trait)
+)]
 
 extern crate linked_hash_map;
 
-pub mod yaml;
+pub mod emitter;
+pub mod parser;
 pub mod scanner;
-pub mod parser;
-pub mod emitter;
+pub mod yaml;
 
 // reexport key APIs
-pub use scanner::ScanError;
+pub use emitter::{EmitError, YamlEmitter};
 pub use parser::Event;
+pub use scanner::ScanError;
 pub use yaml::{Yaml, YamlLoader};
-pub use emitter::{YamlEmitter, EmitError};
 
 #[cfg(test)]
 mod tests {
     use super::*;
 
     #[test]
     fn test_api() {
-        let s =
-"
+        let s = "
 # from yaml-cpp example
 - name: Ogre
   position: [0, 5, 0]
   powers:
     - name: Club
       damage: 10
     - name: Fist
       damage: 8
@@ -99,18 +103,17 @@ mod tests {
 
     fn try_fail(s: &str) -> Result<Vec<Yaml>, ScanError> {
         let t = try!(YamlLoader::load_from_str(s));
         Ok(t)
     }
 
     #[test]
     fn test_fail() {
-        let s =
-"
+        let s = "
 # syntax error
 scalar
 key: [1, 2]]
 key1:a2
 ";
         assert!(YamlLoader::load_from_str(s).is_err());
         assert!(try_fail(s).is_err());
     }
--- a/third_party/rust/yaml-rust/src/parser.rs
+++ b/third_party/rust/yaml-rust/src/parser.rs
@@ -21,17 +21,17 @@ enum State {
     FlowSequenceEntry,
     FlowSequenceEntryMappingKey,
     FlowSequenceEntryMappingValue,
     FlowSequenceEntryMappingEnd,
     FlowMappingFirstKey,
     FlowMappingKey,
     FlowMappingValue,
     FlowMappingEmptyValue,
-    End
+    End,
 }
 
 /// `Event` is used with the low-level event base parsing API,
 /// see `EventReceiver` trait.
 #[derive(Clone, PartialEq, Debug, Eq)]
 pub enum Event {
     /// Reserved for internal use
     Nothing,
@@ -43,17 +43,17 @@ pub enum Event {
     Alias(usize),
     /// Value, style, anchor_id, tag
     Scalar(String, TScalarStyle, usize, Option<TokenType>),
     /// Anchor ID
     SequenceStart(usize),
     SequenceEnd,
     /// Anchor ID
     MappingStart(usize),
-    MappingEnd
+    MappingEnd,
 }
 
 impl Event {
     fn empty_scalar() -> Event {
         // a null scalar
         Event::Scalar("~".to_owned(), TScalarStyle::Plain, 0, None)
     }
 
@@ -69,35 +69,33 @@ pub struct Parser<T> {
     state: State,
     marks: Vec<Marker>,
     token: Option<Token>,
     current: Option<(Event, Marker)>,
     anchors: HashMap<String, usize>,
     anchor_id: usize,
 }
 
-
 pub trait EventReceiver {
     fn on_event(&mut self, ev: Event);
 }
 
-
 pub trait MarkedEventReceiver {
     fn on_event(&mut self, ev: Event, _mark: Marker);
 }
 
 impl<R: EventReceiver> MarkedEventReceiver for R {
     fn on_event(&mut self, ev: Event, _mark: Marker) {
         self.on_event(ev)
     }
 }
 
 pub type ParseResult = Result<(Event, Marker), ScanError>;
 
-impl<T: Iterator<Item=char>> Parser<T> {
+impl<T: Iterator<Item = char>> Parser<T> {
     pub fn new(src: T) -> Parser<T> {
         Parser {
             scanner: Scanner::new(src),
             states: Vec::new(),
             state: State::StreamStart,
             marks: Vec::new(),
             token: None,
             current: None,
@@ -116,49 +114,47 @@ impl<T: Iterator<Item=char>> Parser<T> {
                 self.peek()
             }
         }
     }
 
     pub fn next(&mut self) -> ParseResult {
         match self.current {
             None => self.parse(),
-            Some(_) => {
-                Ok(self.current.take().unwrap())
-            }
+            Some(_) => Ok(self.current.take().unwrap()),
         }
     }
 
     fn peek_token(&mut self) -> Result<&Token, ScanError> {
         match self.token {
-            None =>  {
+            None => {
                 self.token = Some(try!(self.scan_next_token()));
                 Ok(self.token.as_ref().unwrap())
-            },
-            Some(ref tok) => Ok(tok)
+            }
+            Some(ref tok) => Ok(tok),
         }
     }
 
     fn scan_next_token(&mut self) -> Result<Token, ScanError> {
         let token = self.scanner.next();
         match token {
-            None =>
-                match self.scanner.get_error() {
-                    None => Err(ScanError::new(self.scanner.mark(), "unexpected eof")),
-                    Some(e) => Err(e),
-                },
-            Some(tok) => Ok(tok)
+            None => match self.scanner.get_error() {
+                None => Err(ScanError::new(self.scanner.mark(), "unexpected eof")),
+                Some(e) => Err(e),
+            },
+            Some(tok) => Ok(tok),
         }
     }
 
     fn fetch_token(&mut self) -> Token {
-        self.token.take().expect("fetch_token needs to be preceded by peek_token")
+        self.token
+            .take()
+            .expect("fetch_token needs to be preceded by peek_token")
     }
 
-
     fn skip(&mut self) {
         self.token = None;
         //self.peek_token();
     }
     fn pop_state(&mut self) {
         self.state = self.states.pop().unwrap()
     }
     fn push_state(&mut self, state: State) {
@@ -169,18 +165,21 @@ impl<T: Iterator<Item=char>> Parser<T> {
         if self.state == State::End {
             return Ok((Event::StreamEnd, self.scanner.mark()));
         }
         let (ev, mark) = try!(self.state_machine());
         // println!("EV {:?}", ev);
         Ok((ev, mark))
     }
 
-    pub fn load<R: MarkedEventReceiver>(&mut self, recv: &mut R, multi: bool)
-        -> Result<(), ScanError> {
+    pub fn load<R: MarkedEventReceiver>(
+        &mut self,
+        recv: &mut R,
+        multi: bool,
+    ) -> Result<(), ScanError> {
         if !self.scanner.stream_started() {
             let (ev, mark) = try!(self.next());
             assert_eq!(ev, Event::StreamStart);
             recv.on_event(ev, mark);
         }
 
         if self.scanner.stream_ended() {
             // XXX has parsed?
@@ -198,75 +197,82 @@ impl<T: Iterator<Item=char>> Parser<T> {
             try!(self.load_document(ev, mark, recv));
             if !multi {
                 break;
             }
         }
         Ok(())
     }
 
-    fn load_document<R: MarkedEventReceiver>(&mut self, first_ev: Event, mark: Marker, recv: &mut R)
-        -> Result<(), ScanError> {
+    fn load_document<R: MarkedEventReceiver>(
+        &mut self,
+        first_ev: Event,
+        mark: Marker,
+        recv: &mut R,
+    ) -> Result<(), ScanError> {
         assert_eq!(first_ev, Event::DocumentStart);
         recv.on_event(first_ev, mark);
 
         let (ev, mark) = try!(self.next());
         try!(self.load_node(ev, mark, recv));
 
         // DOCUMENT-END is expected.
         let (ev, mark) = try!(self.next());
         assert_eq!(ev, Event::DocumentEnd);
         recv.on_event(ev, mark);
 
         Ok(())
     }
 
-    fn load_node<R: MarkedEventReceiver>(&mut self, first_ev: Event, mark: Marker, recv: &mut R)
-        -> Result<(), ScanError> {
+    fn load_node<R: MarkedEventReceiver>(
+        &mut self,
+        first_ev: Event,
+        mark: Marker,
+        recv: &mut R,
+    ) -> Result<(), ScanError> {
         match first_ev {
             Event::Alias(..) | Event::Scalar(..) => {
                 recv.on_event(first_ev, mark);
                 Ok(())
-            },
+            }
             Event::SequenceStart(_) => {
                 recv.on_event(first_ev, mark);
                 self.load_sequence(recv)
-            },
+            }
             Event::MappingStart(_) => {
                 recv.on_event(first_ev, mark);
                 self.load_mapping(recv)
-            },
-            _ => { println!("UNREACHABLE EVENT: {:?}", first_ev);
-                unreachable!(); }
+            }
+            _ => {
+                println!("UNREACHABLE EVENT: {:?}", first_ev);
+                unreachable!();
+            }
         }
     }
 
-    fn load_mapping<R: MarkedEventReceiver>(&mut self, recv: &mut R)
-        -> Result<(), ScanError> {
+    fn load_mapping<R: MarkedEventReceiver>(&mut self, recv: &mut R) -> Result<(), ScanError> {
         let (mut key_ev, mut key_mark) = try!(self.next());
         while key_ev != Event::MappingEnd {
             // key
             try!(self.load_node(key_ev, key_mark, recv));
 
             // value
             let (ev, mark) = try!(self.next());
             try!(self.load_node(ev, mark, recv));
 
             // next event
             let (ev, mark) = try!(self.next());
             key_ev = ev;
             key_mark = mark;
-
         }
         recv.on_event(key_ev, key_mark);
         Ok(())
     }
 
-    fn load_sequence<R: MarkedEventReceiver>(&mut self, recv: &mut R)
-        -> Result<(), ScanError> {
+    fn load_sequence<R: MarkedEventReceiver>(&mut self, recv: &mut R) -> Result<(), ScanError> {
         let (mut ev, mut mark) = try!(self.next());
         while ev != Event::SequenceEnd {
             try!(self.load_node(ev, mark, recv));
 
             // next event
             let (next_ev, next_mark) = try!(self.next());
             ev = next_ev;
             mark = next_mark;
@@ -284,17 +290,16 @@ impl<T: Iterator<Item=char>> Parser<T> {
             State::ImplicitDocumentStart => self.document_start(true),
             State::DocumentStart => self.document_start(false),
             State::DocumentContent => self.document_content(),
             State::DocumentEnd => self.document_end(),
 
             State::BlockNode => self.parse_node(true, false),
             // State::BlockNodeOrIndentlessSequence => self.parse_node(true, true),
             // State::FlowNode => self.parse_node(false, false),
-
             State::BlockMappingFirstKey => self.block_mapping_key(true),
             State::BlockMappingKey => self.block_mapping_key(false),
             State::BlockMappingValue => self.block_mapping_value(),
 
             State::BlockSequenceFirstEntry => self.block_sequence_entry(true),
             State::BlockSequenceEntry => self.block_sequence_entry(false),
 
             State::FlowSequenceFirstEntry => self.flow_sequence_entry(true),
@@ -317,116 +322,116 @@ impl<T: Iterator<Item=char>> Parser<T> {
     }
 
     fn stream_start(&mut self) -> ParseResult {
         match *try!(self.peek_token()) {
             Token(mark, TokenType::StreamStart(_)) => {
                 self.state = State::ImplicitDocumentStart;
                 self.skip();
                 Ok((Event::StreamStart, mark))
-            },
-            Token(mark, _) => Err(ScanError::new(mark,
-                "did not find expected <stream-start>")),
+            }
+            Token(mark, _) => Err(ScanError::new(mark, "did not find expected <stream-start>")),
         }
     }
 
     fn document_start(&mut self, implicit: bool) -> ParseResult {
         if !implicit {
             while let TokenType::DocumentEnd = try!(self.peek_token()).1 {
                 self.skip();
             }
         }
 
         match *try!(self.peek_token()) {
             Token(mark, TokenType::StreamEnd) => {
                 self.state = State::End;
                 self.skip();
                 Ok((Event::StreamEnd, mark))
-            },
+            }
             Token(_, TokenType::VersionDirective(..))
             | Token(_, TokenType::TagDirective(..))
             | Token(_, TokenType::DocumentStart) => {
                 // explicit document
                 self._explict_document_start()
-            },
+            }
             Token(mark, _) if implicit => {
                 try!(self.parser_process_directives());
                 self.push_state(State::DocumentEnd);
                 self.state = State::BlockNode;
                 Ok((Event::DocumentStart, mark))
-            },
+            }
             _ => {
                 // explicit document
                 self._explict_document_start()
             }
         }
     }
 
     fn parser_process_directives(&mut self) -> Result<(), ScanError> {
         loop {
             match try!(self.peek_token()).1 {
                 TokenType::VersionDirective(_, _) => {
                     // XXX parsing with warning according to spec
                     //if major != 1 || minor > 2 {
                     //    return Err(ScanError::new(tok.0,
                     //        "found incompatible YAML document"));
                     //}
-                },
+                }
                 TokenType::TagDirective(..) => {
                     // TODO add tag directive
-                },
-                _ => break
+                }
+                _ => break,
             }
             self.skip();
         }
         // TODO tag directive
         Ok(())
     }
 
     fn _explict_document_start(&mut self) -> ParseResult {
         try!(self.parser_process_directives());
         match *try!(self.peek_token()) {
             Token(mark, TokenType::DocumentStart) => {
                 self.push_state(State::DocumentEnd);
                 self.state = State::DocumentContent;
                 self.skip();
                 Ok((Event::DocumentStart, mark))
-            }    
-            Token(mark, _) => Err(ScanError::new(mark, "did not find expected <document start>"))
-        }        
+            }
+            Token(mark, _) => Err(ScanError::new(
+                mark,
+                "did not find expected <document start>",
+            )),
+        }
     }
 
     fn document_content(&mut self) -> ParseResult {
         match *try!(self.peek_token()) {
             Token(mark, TokenType::VersionDirective(..))
             | Token(mark, TokenType::TagDirective(..))
             | Token(mark, TokenType::DocumentStart)
             | Token(mark, TokenType::DocumentEnd)
             | Token(mark, TokenType::StreamEnd) => {
                 self.pop_state();
                 // empty scalar
                 Ok((Event::empty_scalar(), mark))
-            },
-            _ => {
-                self.parse_node(true, false)
             }
+            _ => self.parse_node(true, false),
         }
     }
 
     fn document_end(&mut self) -> ParseResult {
         let mut _implicit = true;
         let marker: Marker = match *try!(self.peek_token()) {
             Token(mark, TokenType::DocumentEnd) => {
                 self.skip();
                 _implicit = false;
                 mark
-            },
-            Token(mark, _) => mark
+            }
+            Token(mark, _) => mark,
         };
-        
+
         // TODO tag handling
         self.state = State::DocumentStart;
         Ok((Event::DocumentEnd, marker))
     }
 
     fn register_anchor(&mut self, name: String, _: &Marker) -> Result<usize, ScanError> {
         // anchors can be overrided/reused
         // if self.anchors.contains_key(name) {
@@ -442,88 +447,96 @@ impl<T: Iterator<Item=char>> Parser<T> {
     fn parse_node(&mut self, block: bool, indentless_sequence: bool) -> ParseResult {
         let mut anchor_id = 0;
         let mut tag = None;
         match *try!(self.peek_token()) {
             Token(_, TokenType::Alias(_)) => {
                 self.pop_state();
                 if let Token(mark, TokenType::Alias(name)) = self.fetch_token() {
                     match self.anchors.get(&name) {
-                        None => return Err(ScanError::new(mark, "while parsing node, found unknown anchor")),
-                        Some(id) => return Ok((Event::Alias(*id), mark))
+                        None => {
+                            return Err(ScanError::new(
+                                mark,
+                                "while parsing node, found unknown anchor",
+                            ))
+                        }
+                        Some(id) => return Ok((Event::Alias(*id), mark)),
                     }
                 } else {
                     unreachable!()
                 }
-            },
+            }
             Token(_, TokenType::Anchor(_)) => {
                 if let Token(mark, TokenType::Anchor(name)) = self.fetch_token() {
                     anchor_id = try!(self.register_anchor(name, &mark));
                     if let TokenType::Tag(..) = try!(self.peek_token()).1 {
                         if let tg @ TokenType::Tag(..) = self.fetch_token().1 {
                             tag = Some(tg);
                         } else {
                             unreachable!()
                         }
                     }
                 } else {
                     unreachable!()
                 }
-            },
+            }
             Token(_, TokenType::Tag(..)) => {
                 if let tg @ TokenType::Tag(..) = self.fetch_token().1 {
                     tag = Some(tg);
                     if let TokenType::Anchor(_) = try!(self.peek_token()).1 {
                         if let Token(mark, TokenType::Anchor(name)) = self.fetch_token() {
                             anchor_id = try!(self.register_anchor(name, &mark));
                         } else {
                             unreachable!()
                         }
                     }
                 } else {
                     unreachable!()
                 }
-            },
+            }
             _ => {}
         }
         match *try!(self.peek_token()) {
             Token(mark, TokenType::BlockEntry) if indentless_sequence => {
                 self.state = State::IndentlessSequenceEntry;
                 Ok((Event::SequenceStart(anchor_id), mark))
-            },
+            }
             Token(_, TokenType::Scalar(..)) => {
                 self.pop_state();
                 if let Token(mark, TokenType::Scalar(style, v)) = self.fetch_token() {
                     Ok((Event::Scalar(v, style, anchor_id, tag), mark))
                 } else {
                     unreachable!()
                 }
-            },
+            }
             Token(mark, TokenType::FlowSequenceStart) => {
                 self.state = State::FlowSequenceFirstEntry;
                 Ok((Event::SequenceStart(anchor_id), mark))
-            },
+            }
             Token(mark, TokenType::FlowMappingStart) => {
                 self.state = State::FlowMappingFirstKey;
                 Ok((Event::MappingStart(anchor_id), mark))
-            },
+            }
             Token(mark, TokenType::BlockSequenceStart) if block => {
                 self.state = State::BlockSequenceFirstEntry;
                 Ok((Event::SequenceStart(anchor_id), mark))
-            },
+            }
             Token(mark, TokenType::BlockMappingStart) if block => {
                 self.state = State::BlockMappingFirstKey;
                 Ok((Event::MappingStart(anchor_id), mark))
-            },
+            }
             // ex 7.2, an empty scalar can follow a secondary tag
             Token(mark, _) if tag.is_some() || anchor_id > 0 => {
                 self.pop_state();
                 Ok((Event::empty_scalar_with_anchor(anchor_id, tag), mark))
-            },
-            Token(mark, _) => { Err(ScanError::new(mark, "while parsing a node, did not find expected node content")) }
+            }
+            Token(mark, _) => Err(ScanError::new(
+                mark,
+                "while parsing a node, did not find expected node content",
+            )),
         }
     }
 
     fn block_mapping_key(&mut self, first: bool) -> ParseResult {
         // skip BlockMappingStart
         if first {
             let _ = try!(self.peek_token());
             //self.marks.push(tok.0);
@@ -540,107 +553,109 @@ impl<T: Iterator<Item=char>> Parser<T> {
                         // empty scalar
                         Ok((Event::empty_scalar(), mark))
                     }
                     _ => {
                         self.push_state(State::BlockMappingValue);
                         self.parse_node(true, true)
                     }
                 }
-            },
+            }
             // XXX(chenyh): libyaml failed to parse spec 1.2, ex8.18
             Token(mark, TokenType::Value) => {
                 self.state = State::BlockMappingValue;
                 Ok((Event::empty_scalar(), mark))
-            },
+            }
             Token(mark, TokenType::BlockEnd) => {
                 self.pop_state();
                 self.skip();
                 Ok((Event::MappingEnd, mark))
-            },
-            Token(mark, _) => {
-                Err(ScanError::new(mark, "while parsing a block mapping, did not find expected key"))
             }
+            Token(mark, _) => Err(ScanError::new(
+                mark,
+                "while parsing a block mapping, did not find expected key",
+            )),
         }
     }
 
     fn block_mapping_value(&mut self) -> ParseResult {
         match *try!(self.peek_token()) {
             Token(_, TokenType::Value) => {
                 self.skip();
                 match *try!(self.peek_token()) {
                     Token(mark, TokenType::Key)
                     | Token(mark, TokenType::Value)
                     | Token(mark, TokenType::BlockEnd) => {
                         self.state = State::BlockMappingKey;
                         // empty scalar
                         Ok((Event::empty_scalar(), mark))
-                    },
+                    }
                     _ => {
                         self.push_state(State::BlockMappingKey);
                         self.parse_node(true, true)
                     }
                 }
-            },
+            }
             Token(mark, _) => {
                 self.state = State::BlockMappingKey;
                 // empty scalar
                 Ok((Event::empty_scalar(), mark))
             }
         }
     }
 
     fn flow_mapping_key(&mut self, first: bool) -> ParseResult {
         if first {
             let _ = try!(self.peek_token());
             self.skip();
         }
-        let marker: Marker = {
-            match *try!(self.peek_token()) {
-                Token(mark, TokenType::FlowMappingEnd) => mark,
-                Token(mark, _) => {
-                    if !first {
-                        match *try!(self.peek_token()) {
+        let marker: Marker =
+            {
+                match *try!(self.peek_token()) {
+                    Token(mark, TokenType::FlowMappingEnd) => mark,
+                    Token(mark, _) => {
+                        if !first {
+                            match *try!(self.peek_token()) {
                             Token(_, TokenType::FlowEntry) => self.skip(),
                             Token(mark, _) => return Err(ScanError::new(mark,
                                 "while parsing a flow mapping, did not find expected ',' or '}'"))
                         }
-                    }
+                        }
 
-                    match *try!(self.peek_token()) {
-                        Token(_, TokenType::Key) => {
-                            self.skip();
-                            match *try!(self.peek_token()) {
-                                Token(mark, TokenType::Value)
-                                | Token(mark, TokenType::FlowEntry)
-                                | Token(mark, TokenType::FlowMappingEnd) => {
-                                    self.state = State::FlowMappingValue;
-                                    return Ok((Event::empty_scalar(), mark));
-                                },
-                                _ => {
-                                    self.push_state(State::FlowMappingValue);
-                                    return self.parse_node(false, false);
+                        match *try!(self.peek_token()) {
+                            Token(_, TokenType::Key) => {
+                                self.skip();
+                                match *try!(self.peek_token()) {
+                                    Token(mark, TokenType::Value)
+                                    | Token(mark, TokenType::FlowEntry)
+                                    | Token(mark, TokenType::FlowMappingEnd) => {
+                                        self.state = State::FlowMappingValue;
+                                        return Ok((Event::empty_scalar(), mark));
+                                    }
+                                    _ => {
+                                        self.push_state(State::FlowMappingValue);
+                                        return self.parse_node(false, false);
+                                    }
                                 }
                             }
-                        },
-                        Token(marker, TokenType::Value) => {
-                            self.state = State::FlowMappingValue;
-                            return Ok((Event::empty_scalar(), marker));
-                        },
-                        Token(_, TokenType::FlowMappingEnd) => (),
-                        _ => {
-                            self.push_state(State::FlowMappingEmptyValue);
-                            return self.parse_node(false, false);
+                            Token(marker, TokenType::Value) => {
+                                self.state = State::FlowMappingValue;
+                                return Ok((Event::empty_scalar(), marker));
+                            }
+                            Token(_, TokenType::FlowMappingEnd) => (),
+                            _ => {
+                                self.push_state(State::FlowMappingEmptyValue);
+                                return self.parse_node(false, false);
+                            }
                         }
+
+                        mark
                     }
-
-                    mark
                 }
-            }
-        };
+            };
 
         self.pop_state();
         self.skip();
         Ok((Event::MappingEnd, marker))
     }
 
     fn flow_mapping_value(&mut self, empty: bool) -> ParseResult {
         let mark: Marker = {
@@ -648,62 +663,63 @@ impl<T: Iterator<Item=char>> Parser<T> {
                 let Token(mark, _) = *try!(self.peek_token());
                 self.state = State::FlowMappingKey;
                 return Ok((Event::empty_scalar(), mark));
             } else {
                 match *try!(self.peek_token()) {
                     Token(marker, TokenType::Value) => {
                         self.skip();
                         match try!(self.peek_token()).1 {
-                            TokenType::FlowEntry
-                                | TokenType::FlowMappingEnd => { },
+                            TokenType::FlowEntry | TokenType::FlowMappingEnd => {}
                             _ => {
                                 self.push_state(State::FlowMappingKey);
                                 return self.parse_node(false, false);
                             }
                         }
                         marker
-                    },
-                    Token(marker, _) => marker
+                    }
+                    Token(marker, _) => marker,
                 }
             }
         };
-        
+
         self.state = State::FlowMappingKey;
         Ok((Event::empty_scalar(), mark))
     }
 
     fn flow_sequence_entry(&mut self, first: bool) -> ParseResult {
         // skip FlowMappingStart
         if first {
             let _ = try!(self.peek_token());
             //self.marks.push(tok.0);
             self.skip();
         }
         match *try!(self.peek_token()) {
             Token(mark, TokenType::FlowSequenceEnd) => {
                 self.pop_state();
                 self.skip();
                 return Ok((Event::SequenceEnd, mark));
-            },
+            }
             Token(_, TokenType::FlowEntry) if !first => {
                 self.skip();
-            },
+            }
             Token(mark, _) if !first => {
-                return Err(ScanError::new(mark,
-                        "while parsing a flow sequence, expectd ',' or ']'"));
+                return Err(ScanError::new(
+                    mark,
+                    "while parsing a flow sequence, expectd ',' or ']'",
+                ));
             }
             _ => { /* next */ }
         }
         match *try!(self.peek_token()) {
             Token(mark, TokenType::FlowSequenceEnd) => {
                 self.pop_state();
                 self.skip();
                 Ok((Event::SequenceEnd, mark))
-            },
+            }
             Token(mark, TokenType::Key) => {
                 self.state = State::FlowSequenceEntryMappingKey;
                 self.skip();
                 Ok((Event::MappingStart(0), mark))
             }
             _ => {
                 self.push_state(State::FlowSequenceEntry);
                 self.parse_node(false, false)
@@ -722,17 +738,17 @@ impl<T: Iterator<Item=char>> Parser<T> {
         self.skip();
         match *try!(self.peek_token()) {
             Token(mark, TokenType::BlockEntry)
             | Token(mark, TokenType::Key)
             | Token(mark, TokenType::Value)
             | Token(mark, TokenType::BlockEnd) => {
                 self.state = State::IndentlessSequenceEntry;
                 Ok((Event::empty_scalar(), mark))
-            },
+            }
             _ => {
                 self.push_state(State::IndentlessSequenceEntry);
                 self.parse_node(true, false)
             }
         }
     }
 
     fn block_sequence_entry(&mut self, first: bool) -> ParseResult {
@@ -742,71 +758,69 @@ impl<T: Iterator<Item=char>> Parser<T> {
             //self.marks.push(tok.0);
             self.skip();
         }
         match *try!(self.peek_token()) {
             Token(mark, TokenType::BlockEnd) => {
                 self.pop_state();
                 self.skip();
                 Ok((Event::SequenceEnd, mark))
-            },
+            }
             Token(_, TokenType::BlockEntry) => {
                 self.skip();
                 match *try!(self.peek_token()) {
-                    Token(mark, TokenType::BlockEntry)
-                    | Token(mark, TokenType::BlockEnd) => {
+                    Token(mark, TokenType::BlockEntry) | Token(mark, TokenType::BlockEnd) => {
                         self.state = State::BlockSequenceEntry;
                         Ok((Event::empty_scalar(), mark))
-                    },
+                    }
                     _ => {
                         self.push_state(State::BlockSequenceEntry);
                         self.parse_node(true, false)
                     }
                 }
-            },
-            Token(mark, _) => {
-                Err(ScanError::new(mark,
-                        "while parsing a block collection, did not find expected '-' indicator"))
             }
+            Token(mark, _) => Err(ScanError::new(
+                mark,
+                "while parsing a block collection, did not find expected '-' indicator",
+            )),
         }
     }
 
     fn flow_sequence_entry_mapping_key(&mut self) -> ParseResult {
         match *try!(self.peek_token()) {
             Token(mark, TokenType::Value)
             | Token(mark, TokenType::FlowEntry)
             | Token(mark, TokenType::FlowSequenceEnd) => {
                 self.skip();
                 self.state = State::FlowSequenceEntryMappingValue;
                 Ok((Event::empty_scalar(), mark))
-            },
+            }
             _ => {
                 self.push_state(State::FlowSequenceEntryMappingValue);
                 self.parse_node(false, false)
             }
         }
     }
 
     fn flow_sequence_entry_mapping_value(&mut self) -> ParseResult {
         match *try!(self.peek_token()) {
             Token(_, TokenType::Value) => {
-                    self.skip();
-                    self.state = State::FlowSequenceEntryMappingValue;
-                    match *try!(self.peek_token()) {
-                        Token(mark, TokenType::FlowEntry)
-                        | Token(mark, TokenType::FlowSequenceEnd) => {
-                            self.state = State::FlowSequenceEntryMappingEnd;
-                            Ok((Event::empty_scalar(), mark))
-                        },
-                        _ => {
-                            self.push_state(State::FlowSequenceEntryMappingEnd);
-                            self.parse_node(false, false)
-                        }
+                self.skip();
+                self.state = State::FlowSequenceEntryMappingValue;
+                match *try!(self.peek_token()) {
+                    Token(mark, TokenType::FlowEntry) | Token(mark, TokenType::FlowSequenceEnd) => {
+                        self.state = State::FlowSequenceEntryMappingEnd;
+                        Ok((Event::empty_scalar(), mark))
                     }
-            },
+                    _ => {
+                        self.push_state(State::FlowSequenceEntryMappingEnd);
+                        self.parse_node(false, false)
+                    }
+                }
+            }
             Token(mark, _) => {
                 self.state = State::FlowSequenceEntryMappingEnd;
                 Ok((Event::empty_scalar(), mark))
             }
         }
     }
 
     fn flow_sequence_entry_mapping_end(&mut self) -> ParseResult {
--- a/third_party/rust/yaml-rust/src/scanner.rs
+++ b/third_party/rust/yaml-rust/src/scanner.rs
@@ -1,42 +1,38 @@
 use std::collections::VecDeque;
+use std::error::Error;
 use std::{char, fmt};
-use std::error::Error;
 
 #[derive(Clone, Copy, PartialEq, Debug, Eq)]
 pub enum TEncoding {
-    Utf8
+    Utf8,
 }
 
 #[derive(Clone, Copy, PartialEq, Debug, Eq)]
 pub enum TScalarStyle {
     Any,
     Plain,
     SingleQuoted,
     DoubleQuoted,
 
     Literal,
-    Foled
+    Foled,
 }
 
 #[derive(Clone, Copy, PartialEq, Debug, Eq)]
 pub struct Marker {
     index: usize,
     line: usize,
     col: usize,
 }
 
 impl Marker {
     fn new(index: usize, line: usize, col: usize) -> Marker {
-        Marker {
-            index: index,
-            line: line,
-            col: col
-        }
+        Marker { index, line, col }
     }
 
     pub fn index(&self) -> usize {
         self.index
     }
 
     pub fn line(&self) -> usize {
         self.line
@@ -52,17 +48,17 @@ pub struct ScanError {
     mark: Marker,
     info: String,
 }
 
 impl ScanError {
     pub fn new(loc: Marker, info: &str) -> ScanError {
         ScanError {
             mark: loc,
-            info: info.to_owned()
+            info: info.to_owned(),
         }
     }
 
     pub fn marker(&self) -> &Marker {
         &self.mark
     }
 }
 
@@ -74,18 +70,23 @@ impl Error for ScanError {
     fn cause(&self) -> Option<&Error> {
         None
     }
 }
 
 impl fmt::Display for ScanError {
     // col starts from 0
     fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
-        write!(formatter, "{} at line {} column {}", self.info,
-               self.mark.line, self.mark.col + 1)
+        write!(
+            formatter,
+            "{} at line {} column {}",
+            self.info,
+            self.mark.line,
+            self.mark.col + 1
+        )
     }
 }
 
 #[derive(Clone, PartialEq, Debug, Eq)]
 pub enum TokenType {
     NoToken,
     StreamStart(TEncoding),
     StreamEnd,
@@ -105,17 +106,17 @@ pub enum TokenType {
     BlockEntry,
     FlowEntry,
     Key,
     Value,
     Alias(String),
     Anchor(String),
     /// handle, suffix
     Tag(String, String),
-    Scalar(TScalarStyle, String)
+    Scalar(TScalarStyle, String),
 }
 
 #[derive(Clone, PartialEq, Debug, Eq)]
 pub struct Token(pub Marker, pub TokenType);
 
 #[derive(Clone, PartialEq, Debug, Eq)]
 struct SimpleKey {
     possible: bool,
@@ -125,17 +126,17 @@ struct SimpleKey {
 }
 
 impl SimpleKey {
     fn new(mark: Marker) -> SimpleKey {
         SimpleKey {
             possible: false,
             required: false,
             token_number: 0,
-            mark: mark,
+            mark,
         }
     }
 }
 
 #[derive(Debug)]
 pub struct Scanner<T> {
     rdr: T,
     mark: Marker,
@@ -144,22 +145,22 @@ pub struct Scanner<T> {
     error: Option<ScanError>,
 
     stream_start_produced: bool,
     stream_end_produced: bool,
     simple_key_allowed: bool,
     simple_keys: Vec<SimpleKey>,
     indent: isize,
     indents: Vec<isize>,
-    flow_level: usize,
+    flow_level: u8,
     tokens_parsed: usize,
     token_available: bool,
 }
 
-impl<T: Iterator<Item=char>> Iterator for Scanner<T> {
+impl<T: Iterator<Item = char>> Iterator for Scanner<T> {
     type Item = Token;
     fn next(&mut self) -> Option<Token> {
         if self.error.is_some() {
             return None;
         }
         match self.next_token() {
             Ok(tok) => tok,
             Err(e) => {
@@ -194,42 +195,40 @@ fn is_blankz(c: char) -> bool {
 fn is_digit(c: char) -> bool {
     c >= '0' && c <= '9'
 }
 #[inline]
 fn is_alpha(c: char) -> bool {
     match c {
         '0'...'9' | 'a'...'z' | 'A'...'Z' => true,
         '_' | '-' => true,
-        _ => false
+        _ => false,
     }
 }
 #[inline]
 fn is_hex(c: char) -> bool {
-    (c >= '0' && c <= '9')
-        || (c >= 'a' && c <= 'f')
-        || (c >= 'A' && c <= 'F')
+    (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')
 }
 #[inline]
 fn as_hex(c: char) -> u32 {
     match c {
         '0'...'9' => (c as u32) - ('0' as u32),
         'a'...'f' => (c as u32) - ('a' as u32) + 10,
         'A'...'F' => (c as u32) - ('A' as u32) + 10,
-        _ => unreachable!()
+        _ => unreachable!(),
     }
 }
 
 pub type ScanResult = Result<(), ScanError>;
 
-impl<T: Iterator<Item=char>> Scanner<T> {
+impl<T: Iterator<Item = char>> Scanner<T> {
     /// Creates the YAML tokenizer.
     pub fn new(rdr: T) -> Scanner<T> {
         Scanner {
-            rdr: rdr,
+            rdr,
             buffer: VecDeque::new(),
             mark: Marker::new(0, 1, 0),
             tokens: VecDeque::new(),
             error: None,
 
             stream_start_produced: false,
             stream_end_produced: false,
             simple_key_allowed: true,
@@ -321,20 +320,20 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         let old_len = self.tokens.len();
         assert!(pos <= old_len);
         self.tokens.push_back(tok);
         for i in 0..old_len - pos {
             self.tokens.swap(old_len - i, old_len - i - 1);
         }
     }
     fn allow_simple_key(&mut self) {
-            self.simple_key_allowed = true;
+        self.simple_key_allowed = true;
     }
     fn disallow_simple_key(&mut self) {
-            self.simple_key_allowed = false;
+        self.simple_key_allowed = false;
     }
 
     pub fn fetch_next_token(&mut self) -> ScanResult {
         self.lookahead(1);
         // println!("--> fetch_next_token Cur {:?} {:?}", self.mark, self.ch());
 
         if !self.stream_start_produced {
             self.fetch_stream_start();
@@ -358,26 +357,28 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         if self.mark.col == 0 && self.ch_is('%') {
             return self.fetch_directive();
         }
 
         if self.mark.col == 0
             && self.buffer[0] == '-'
             && self.buffer[1] == '-'
             && self.buffer[2] == '-'
-            && is_blankz(self.buffer[3]) {
+            && is_blankz(self.buffer[3])
+        {
             try!(self.fetch_document_indicator(TokenType::DocumentStart));
             return Ok(());
         }
 
         if self.mark.col == 0
             && self.buffer[0] == '.'
             && self.buffer[1] == '.'
             && self.buffer[2] == '.'
-            && is_blankz(self.buffer[3]) {
+            && is_blankz(self.buffer[3])
+        {
             try!(self.fetch_document_indicator(TokenType::DocumentEnd));
             return Ok(());
         }
 
         let c = self.buffer[0];
         let nc = self.buffer[1];
         match c {
             '[' => self.fetch_flow_collection_start(TokenType::FlowSequenceStart),
@@ -397,18 +398,20 @@ impl<T: Iterator<Item=char>> Scanner<T> 
             '|' if self.flow_level == 0 => self.fetch_block_scalar(true),
             // Is it a folded scalar?
             '>' if self.flow_level == 0 => self.fetch_block_scalar(false),
             '\'' => self.fetch_flow_scalar(true),
             '"' => self.fetch_flow_scalar(false),
             // plain scalar
             '-' if !is_blankz(nc) => self.fetch_plain_scalar(),
             ':' | '?' if !is_blankz(nc) && self.flow_level == 0 => self.fetch_plain_scalar(),
-            '%' | '@' | '`' => Err(ScanError::new(self.mark,
-                    &format!("unexpected character: `{}'", c))),
+            '%' | '@' | '`' => Err(ScanError::new(
+                self.mark,
+                &format!("unexpected character: `{}'", c),
+            )),
             _ => self.fetch_plain_scalar(),
         }
     }
 
     pub fn next_token(&mut self) -> Result<Option<Token>, ScanError> {
         if self.stream_end_produced {
             return Ok(None);
         }
@@ -437,33 +440,36 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                 for sk in &self.simple_keys {
                     if sk.possible && sk.token_number == self.tokens_parsed {
                         need_more = true;
                         break;
                     }
                 }
             }
 
-            if !need_more { break; }
+            if !need_more {
+                break;
+            }
             try!(self.fetch_next_token());
         }
         self.token_available = true;
 
         Ok(())
     }
 
     fn stale_simple_keys(&mut self) -> ScanResult {
         for sk in &mut self.simple_keys {
-            if sk.possible && (sk.mark.line < self.mark.line
-                || sk.mark.index + 1024 < self.mark.index) {
-                    if sk.required {
-                        return Err(ScanError::new(self.mark, "simple key expect ':'"));
-                    }
-                    sk.possible = false;
+            if sk.possible
+                && (sk.mark.line < self.mark.line || sk.mark.index + 1024 < self.mark.index)
+            {
+                if sk.required {
+                    return Err(ScanError::new(self.mark, "simple key expect ':'"));
                 }
+                sk.possible = false;
+            }
         }
         Ok(())
     }
 
     fn skip_to_next_token(&mut self) {
         loop {
             self.lookahead(1);
             // TODO(chenyh) BOM
@@ -471,44 +477,49 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                 ' ' => self.skip(),
                 '\t' if self.flow_level > 0 || !self.simple_key_allowed => self.skip(),
                 '\n' | '\r' => {
                     self.lookahead(2);
                     self.skip_line();
                     if self.flow_level == 0 {
                         self.allow_simple_key();
                     }
+                }
+                '#' => while !is_breakz(self.ch()) {
+                    self.skip();
+                    self.lookahead(1);
                 },
-                '#' => while !is_breakz(self.ch()) { self.skip(); self.lookahead(1); },
-                _ => break
+                _ => break,
             }
         }
     }
 
     fn fetch_stream_start(&mut self) {
         let mark = self.mark;
         self.indent = -1;
         self.stream_start_produced = true;
         self.allow_simple_key();
-        self.tokens.push_back(Token(mark, TokenType::StreamStart(TEncoding::Utf8)));
-        self.simple_keys.push(SimpleKey::new(Marker::new(0,0,0)));
+        self.tokens
+            .push_back(Token(mark, TokenType::StreamStart(TEncoding::Utf8)));
+        self.simple_keys.push(SimpleKey::new(Marker::new(0, 0, 0)));
     }
 
     fn fetch_stream_end(&mut self) -> ScanResult {
         // force new line
         if self.mark.col != 0 {
             self.mark.col = 0;
             self.mark.line += 1;
         }
 
         self.unroll_indent(-1);
         try!(self.remove_simple_key());
         self.disallow_simple_key();
 
-        self.tokens.push_back(Token(self.mark, TokenType::StreamEnd));
+        self.tokens
+            .push_back(Token(self.mark, TokenType::StreamEnd));
         Ok(())
     }
 
     fn fetch_directive(&mut self) -> ScanResult {
         self.unroll_indent(-1);
         try!(self.remove_simple_key());
 
         self.disallow_simple_key();
@@ -521,32 +532,31 @@ impl<T: Iterator<Item=char>> Scanner<T> 
     }
 
     fn scan_directive(&mut self) -> Result<Token, ScanError> {
         let start_mark = self.mark;
         self.skip();
 
         let name = try!(self.scan_directive_name());
         let tok = match name.as_ref() {
-            "YAML" => {
-                try!(self.scan_version_directive_value(&start_mark))
-            },
-            "TAG" => {
-                try!(self.scan_tag_directive_value(&start_mark))
-            },
+            "YAML" => try!(self.scan_version_directive_value(&start_mark)),
+            "TAG" => try!(self.scan_tag_directive_value(&start_mark)),
             // XXX This should be a warning instead of an error
             _ => {
                 // skip current line
                 self.lookahead(1);
                 while !is_breakz(self.ch()) {
                     self.skip();
                     self.lookahead(1);
                 }
                 // XXX return an empty TagDirective token
-                Token(start_mark, TokenType::TagDirective(String::new(), String::new()))
+                Token(
+                    start_mark,
+                    TokenType::TagDirective(String::new(), String::new()),
+                )
                 // return Err(ScanError::new(start_mark,
                 //     "while scanning a directive, found unknown directive name"))
             }
         };
         self.lookahead(1);
 
         while is_blank(self.ch()) {
             self.skip();
@@ -556,18 +566,20 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         if self.ch() == '#' {
             while !is_breakz(self.ch()) {
                 self.skip();
                 self.lookahead(1);
             }
         }
 
         if !is_breakz(self.ch()) {
-            return Err(ScanError::new(start_mark,
-                "while scanning a directive, did not find expected comment or line break"));
+            return Err(ScanError::new(
+                start_mark,
+                "while scanning a directive, did not find expected comment or line break",
+            ));
         }
 
         // Eat a line break
         if is_break(self.ch()) {
             self.lookahead(2);
             self.skip_line();
         }
 
@@ -580,18 +592,20 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         while is_blank(self.ch()) {
             self.skip();
             self.lookahead(1);
         }
 
         let major = try!(self.scan_version_directive_number(mark));
 
         if self.ch() != '.' {
-            return Err(ScanError::new(*mark,
-                "while scanning a YAML directive, did not find expected digit or '.' character"));
+            return Err(ScanError::new(
+                *mark,
+                "while scanning a YAML directive, did not find expected digit or '.' character",
+            ));
         }
 
         self.skip();
 
         let minor = try!(self.scan_version_directive_number(mark));
 
         Ok(Token(*mark, TokenType::VersionDirective(major, minor)))
     }
@@ -602,46 +616,54 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         self.lookahead(1);
         while is_alpha(self.ch()) {
             string.push(self.ch());
             self.skip();
             self.lookahead(1);
         }
 
         if string.is_empty() {
-            return Err(ScanError::new(start_mark,
-                    "while scanning a directive, could not find expected directive name"));
+            return Err(ScanError::new(
+                start_mark,
+                "while scanning a directive, could not find expected directive name",
+            ));
         }
 
         if !is_blankz(self.ch()) {
-            return Err(ScanError::new(start_mark,
-                    "while scanning a directive, found unexpected non-alphabetical character"));
+            return Err(ScanError::new(
+                start_mark,
+                "while scanning a directive, found unexpected non-alphabetical character",
+            ));
         }
 
         Ok(string)
     }
 
     fn scan_version_directive_number(&mut self, mark: &Marker) -> Result<u32, ScanError> {
         let mut val = 0u32;
         let mut length = 0usize;
         self.lookahead(1);
         while is_digit(self.ch()) {
             if length + 1 > 9 {
-                return Err(ScanError::new(*mark,
-                    "while scanning a YAML directive, found extremely long version number"));
+                return Err(ScanError::new(
+                    *mark,
+                    "while scanning a YAML directive, found extremely long version number",
+                ));
             }
             length += 1;
             val = val * 10 + ((self.ch() as u32) - ('0' as u32));
             self.skip();
             self.lookahead(1);
         }
 
         if length == 0 {
-                return Err(ScanError::new(*mark,
-                    "while scanning a YAML directive, did not find expected version number"));
+            return Err(ScanError::new(
+                *mark,
+                "while scanning a YAML directive, did not find expected version number",
+            ));
         }
 
         Ok(val)
     }
 
     fn scan_tag_directive_value(&mut self, mark: &Marker) -> Result<Token, ScanError> {
         self.lookahead(1);
         /* Eat whitespaces. */
@@ -661,18 +683,20 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         let is_secondary = handle == "!!";
         let prefix = try!(self.scan_tag_uri(true, is_secondary, &String::new(), mark));
 
         self.lookahead(1);
 
         if is_blankz(self.ch()) {
             Ok(Token(*mark, TokenType::TagDirective(handle, prefix)))
         } else {
-            Err(ScanError::new(*mark,
-                "while scanning TAG, did not find expected whitespace or line break"))
+            Err(ScanError::new(
+                *mark,
+                "while scanning TAG, did not find expected whitespace or line break",
+            ))
         }
     }
 
     fn fetch_tag(&mut self) -> ScanResult {
         try!(self.save_simple_key());
         self.disallow_simple_key();
 
         let tok = try!(self.scan_tag());
@@ -691,18 +715,20 @@ impl<T: Iterator<Item=char>> Scanner<T> 
 
         if self.buffer[1] == '<' {
             // Eat '!<'
             self.skip();
             self.skip();
             suffix = try!(self.scan_tag_uri(false, false, &String::new(), &start_mark));
 
             if self.ch() != '>' {
-                return Err(ScanError::new(start_mark,
-                    "while scanning a tag, did not find the expected '>'"));
+                return Err(ScanError::new(
+                    start_mark,
+                    "while scanning a tag, did not find the expected '>'",
+                ));
             }
 
             self.skip();
         } else {
             // The tag has either the '!suffix' or the '!handle!suffix'
             handle = try!(self.scan_tag_handle(false, &start_mark));
             // Check if it is, indeed, handle.
             if handle.len() >= 2 && handle.starts_with('!') && handle.ends_with('!') {
@@ -722,27 +748,31 @@ impl<T: Iterator<Item=char>> Scanner<T> 
             }
         }
 
         self.lookahead(1);
         if is_blankz(self.ch()) {
             // XXX: ex 7.2, an empty scalar can follow a secondary tag
             Ok(Token(start_mark, TokenType::Tag(handle, suffix)))
         } else {
-            Err(ScanError::new(start_mark,
-                "while scanning a tag, did not find expected whitespace or line break"))
+            Err(ScanError::new(
+                start_mark,
+                "while scanning a tag, did not find expected whitespace or line break",
+            ))
         }
     }
 
     fn scan_tag_handle(&mut self, directive: bool, mark: &Marker) -> Result<String, ScanError> {
         let mut string = String::new();
         self.lookahead(1);
         if self.ch() != '!' {
-            return Err(ScanError::new(*mark,
-                "while scanning a tag, did not find expected '!'"));
+            return Err(ScanError::new(
+                *mark,
+                "while scanning a tag, did not find expected '!'",
+            ));
         }
 
         string.push(self.ch());
         self.skip();
 
         self.lookahead(1);
         while is_alpha(self.ch()) {
             string.push(self.ch());
@@ -753,24 +783,31 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         // Check if the trailing character is '!' and copy it.
         if self.ch() == '!' {
             string.push(self.ch());
             self.skip();
         } else if directive && string != "!" {
             // It's either the '!' tag or not really a tag handle.  If it's a %TAG
             // directive, it's an error.  If it's a tag token, it must be a part of
             // URI.
-            return Err(ScanError::new(*mark,
-                "while parsing a tag directive, did not find expected '!'"));
+            return Err(ScanError::new(
+                *mark,
+                "while parsing a tag directive, did not find expected '!'",
+            ));
         }
         Ok(string)
     }
 
-    fn scan_tag_uri(&mut self, directive: bool, _is_secondary: bool,
-                head: &str, mark: &Marker) -> Result<String, ScanError> {
+    fn scan_tag_uri(
+        &mut self,
+        directive: bool,
+        _is_secondary: bool,
+        head: &str,
+        mark: &Marker,
+    ) -> Result<String, ScanError> {
         let mut length = head.len();
         let mut string = String::new();
 
         // Copy the head if needed.
         // Note that we don't copy the leading '!' character.
         if length > 1 {
             string.extend(head.chars().skip(1));
         }
@@ -783,146 +820,151 @@ impl<T: Iterator<Item=char>> Scanner<T> 
          *      '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']',
          *      '%'.
          */
         while match self.ch() {
             ';' | '/' | '?' | ':' | '@' | '&' => true,
             '=' | '+' | '$' | ',' | '.' | '!' | '~' | '*' | '\'' | '(' | ')' | '[' | ']' => true,
             '%' => true,
             c if is_alpha(c) => true,
-            _ => false
+            _ => false,
         } {
             // Check if it is a URI-escape sequence.
             if self.ch() == '%' {
                 string.push(try!(self.scan_uri_escapes(directive, mark)));
             } else {
                 string.push(self.ch());
                 self.skip();
             }
 
             length += 1;
             self.lookahead(1);
         }
 
         if length == 0 {
-            return Err(ScanError::new(*mark,
-                "while parsing a tag, did not find expected tag URI"));
+            return Err(ScanError::new(
+                *mark,
+                "while parsing a tag, did not find expected tag URI",
+            ));
         }
 
         Ok(string)
     }
 
-    fn scan_uri_escapes(&mut self, _directive: bool, mark: &Marker)
-        -> Result<char, ScanError> {
+    fn scan_uri_escapes(&mut self, _directive: bool, mark: &Marker) -> Result<char, ScanError> {
         let mut width = 0usize;
         let mut code = 0u32;
         loop {
             self.lookahead(3);
 
-            if !(self.ch() == '%'
-                 && is_hex(self.buffer[1])
-                 && is_hex(self.buffer[2])) {
-                return Err(ScanError::new(*mark,
-                    "while parsing a tag, did not find URI escaped octet"));
+            if !(self.ch() == '%' && is_hex(self.buffer[1]) && is_hex(self.buffer[2])) {
+                return Err(ScanError::new(
+                    *mark,
+                    "while parsing a tag, did not find URI escaped octet",
+                ));
             }
 
             let octet = (as_hex(self.buffer[1]) << 4) + as_hex(self.buffer[2]);
             if width == 0 {
                 width = match octet {
                     _ if octet & 0x80 == 0x00 => 1,
                     _ if octet & 0xE0 == 0xC0 => 2,
                     _ if octet & 0xF0 == 0xE0 => 3,
                     _ if octet & 0xF8 == 0xF0 => 4,
                     _ => {
-                        return Err(ScanError::new(*mark,
-                            "while parsing a tag, found an incorrect leading UTF-8 octet"));
+                        return Err(ScanError::new(
+                            *mark,
+                            "while parsing a tag, found an incorrect leading UTF-8 octet",
+                        ));
                     }
                 };
                 code = octet;
             } else {
                 if octet & 0xc0 != 0x80 {
-                        return Err(ScanError::new(*mark,
-                            "while parsing a tag, found an incorrect trailing UTF-8 octet"));
+                    return Err(ScanError::new(
+                        *mark,
+                        "while parsing a tag, found an incorrect trailing UTF-8 octet",
+                    ));
                 }
                 code = (code << 8) + octet;
             }
 
             self.skip();
             self.skip();
             self.skip();
 
             width -= 1;
             if width == 0 {
                 break;
             }
         }
 
         match char::from_u32(code) {
             Some(ch) => Ok(ch),
-            None => Err(ScanError::new(*mark,
-                "while parsing a tag, found an invalid UTF-8 codepoint"))
+            None => Err(ScanError::new(
+                *mark,
+                "while parsing a tag, found an invalid UTF-8 codepoint",
+            )),
         }
     }
 
     fn fetch_anchor(&mut self, alias: bool) -> ScanResult {
         try!(self.save_simple_key());
         self.disallow_simple_key();
 
         let tok = try!(self.scan_anchor(alias));
 
         self.tokens.push_back(tok);
 
         Ok(())
     }
 
-    fn scan_anchor(&mut self, alias: bool)
-        -> Result<Token, ScanError> {
+    fn scan_anchor(&mut self, alias: bool) -> Result<Token, ScanError> {
         let mut string = String::new();
         let start_mark = self.mark;
 
         self.skip();
         self.lookahead(1);
         while is_alpha(self.ch()) {
             string.push(self.ch());
             self.skip();
             self.lookahead(1);
         }
 
-        if string.is_empty()
-            || match self.ch() {
-                c if is_blankz(c) => false,
-                '?' | ':' | ',' | ']' | '}' | '%' | '@' | '`' => false,
-                _ => true
-            } {
+        if string.is_empty() || match self.ch() {
+            c if is_blankz(c) => false,
+            '?' | ':' | ',' | ']' | '}' | '%' | '@' | '`' => false,
+            _ => true,
+        } {
             return Err(ScanError::new(start_mark, "while scanning an anchor or alias, did not find expected alphabetic or numeric character"));
         }
 
         if alias {
             Ok(Token(start_mark, TokenType::Alias(string)))
         } else {
             Ok(Token(start_mark, TokenType::Anchor(string)))
         }
     }
 
-    fn fetch_flow_collection_start(&mut self, tok :TokenType) -> ScanResult {
+    fn fetch_flow_collection_start(&mut self, tok: TokenType) -> ScanResult {
         // The indicators '[' and '{' may start a simple key.
         try!(self.save_simple_key());
 
-        self.increase_flow_level();
+        self.increase_flow_level()?;
 
         self.allow_simple_key();
 
         let start_mark = self.mark;
         self.skip();
 
         self.tokens.push_back(Token(start_mark, tok));
         Ok(())
     }
 
-    fn fetch_flow_collection_end(&mut self, tok :TokenType) -> ScanResult {
+    fn fetch_flow_collection_end(&mut self, tok: TokenType) -> ScanResult {
         try!(self.remove_simple_key());
         self.decrease_flow_level();
 
         self.disallow_simple_key();
 
         let start_mark = self.mark;
         self.skip();
 
@@ -932,53 +974,64 @@ impl<T: Iterator<Item=char>> Scanner<T> 
 
     fn fetch_flow_entry(&mut self) -> ScanResult {
         try!(self.remove_simple_key());
         self.allow_simple_key();
 
         let start_mark = self.mark;
         self.skip();
 
-        self.tokens.push_back(Token(start_mark, TokenType::FlowEntry));
+        self.tokens
+            .push_back(Token(start_mark, TokenType::FlowEntry));
         Ok(())
     }
 
-    fn increase_flow_level(&mut self) {
-        self.simple_keys.push(SimpleKey::new(Marker::new(0,0,0)));
-        self.flow_level += 1;
+    fn increase_flow_level(&mut self) -> ScanResult {
+        self.simple_keys.push(SimpleKey::new(Marker::new(0, 0, 0)));
+        self.flow_level = self
+            .flow_level
+            .checked_add(1)
+            .ok_or_else(|| ScanError::new(self.mark, "recursion limit exceeded"))?;
+        Ok(())
     }
     fn decrease_flow_level(&mut self) {
         if self.flow_level > 0 {
             self.flow_level -= 1;
             self.simple_keys.pop().unwrap();
         }
     }
 
     fn fetch_block_entry(&mut self) -> ScanResult {
         if self.flow_level == 0 {
             // Check if we are allowed to start a new entry.
             if !self.simple_key_allowed {
-                return Err(ScanError::new(self.mark,
-                        "block sequence entries are not allowed in this context"));
+                return Err(ScanError::new(
+                    self.mark,
+                    "block sequence entries are not allowed in this context",
+                ));
             }
 
             let mark = self.mark;
             // generate BLOCK-SEQUENCE-START if indented
             self.roll_indent(mark.col, None, TokenType::BlockSequenceStart, mark);
         } else {
             // - * only allowed in block
-            return Err(ScanError::new(self.mark, r#""-" is only valid inside a block"#))
+            return Err(ScanError::new(
+                self.mark,
+                r#""-" is only valid inside a block"#,
+            ));
         }
         try!(self.remove_simple_key());
         self.allow_simple_key();
 
         let start_mark = self.mark;
         self.skip();
 
-        self.tokens.push_back(Token(start_mark, TokenType::BlockEntry));
+        self.tokens
+            .push_back(Token(start_mark, TokenType::BlockEntry));
         Ok(())
     }
 
     fn fetch_document_indicator(&mut self, t: TokenType) -> ScanResult {
         self.unroll_indent(-1);
         try!(self.remove_simple_key());
         self.disallow_simple_key();
 
@@ -1022,26 +1075,30 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                 chomping = 1;
             } else {
                 chomping = -1;
             }
             self.skip();
             self.lookahead(1);
             if is_digit(self.ch()) {
                 if self.ch() == '0' {
-                    return Err(ScanError::new(start_mark,
-                            "while scanning a block scalar, found an intendation indicator equal to 0"));
+                    return Err(ScanError::new(
+                        start_mark,
+                        "while scanning a block scalar, found an intendation indicator equal to 0",
+                    ));
                 }
                 increment = (self.ch() as usize) - ('0' as usize);
                 self.skip();
             }
         } else if is_digit(self.ch()) {
             if self.ch() == '0' {
-                return Err(ScanError::new(start_mark,
-                         "while scanning a block scalar, found an intendation indicator equal to 0"));
+                return Err(ScanError::new(
+                    start_mark,
+                    "while scanning a block scalar, found an intendation indicator equal to 0",
+                ));
             }
 
             increment = (self.ch() as usize) - ('0' as usize);
             self.skip();
             self.lookahead(1);
             if self.ch() == '+' || self.ch() == '-' {
                 if self.ch() == '+' {
                     chomping = 1;
@@ -1064,61 +1121,68 @@ impl<T: Iterator<Item=char>> Scanner<T> 
             while !is_breakz(self.ch()) {
                 self.skip();
                 self.lookahead(1);
             }
         }
 
         // Check if we are at the end of the line.
         if !is_breakz(self.ch()) {
-            return Err(ScanError::new(start_mark,
-                    "while scanning a block scalar, did not find expected comment or line break"));
+            return Err(ScanError::new(
+                start_mark,
+                "while scanning a block scalar, did not find expected comment or line break",
+            ));
         }
 
         if is_break(self.ch()) {
             self.lookahead(2);
             self.skip_line();
         }
 
         if increment > 0 {
-            indent = if self.indent >= 0 { (self.indent + increment as isize) as usize } else { increment }
+            indent = if self.indent >= 0 {
+                (self.indent + increment as isize) as usize
+            } else {
+                increment
+            }
         }
         // Scan the leading line breaks and determine the indentation level if needed.
         try!(self.block_scalar_breaks(&mut indent, &mut trailing_breaks));
 
         self.lookahead(1);
 
         let start_mark = self.mark;
 
         while self.mark.col == indent && !is_z(self.ch()) {
             // We are at the beginning of a non-empty line.
             trailing_blank = is_blank(self.ch());
-            if !literal && !leading_break.is_empty()
-                && !leading_blank && !trailing_blank {
-                    if trailing_breaks.is_empty() {
-                        string.push(' ');
-                    }
-                    leading_break.clear();
+            if !literal && !leading_break.is_empty() && !leading_blank && !trailing_blank {
+                if trailing_breaks.is_empty() {
+                    string.push(' ');
+                }
+                leading_break.clear();
             } else {
                 string.push_str(&leading_break);
                 leading_break.clear();
             }
 
             string.push_str(&trailing_breaks);
             trailing_breaks.clear();
 
             leading_blank = is_blank(self.ch());
 
             while !is_breakz(self.ch()) {
                 string.push(self.ch());
                 self.skip();
                 self.lookahead(1);
             }
             // break on EOF
-            if is_z(self.ch()) { break; }
+            if is_z(self.ch()) {
+                break;
+            }
 
             self.lookahead(2);
             self.read_break(&mut leading_break);
 
             // Eat the following intendation spaces and line breaks.
             try!(self.block_scalar_breaks(&mut indent, &mut trailing_breaks));
         }
 
@@ -1127,39 +1191,43 @@ impl<T: Iterator<Item=char>> Scanner<T> 
             string.push_str(&leading_break);
         }
 
         if chomping == 1 {
             string.push_str(&trailing_breaks);
         }
 
         if literal {
-            Ok(Token(start_mark, TokenType::Scalar(TScalarStyle::Literal, string)))
+            Ok(Token(
+                start_mark,
+                TokenType::Scalar(TScalarStyle::Literal, string),
+            ))
         } else {
-            Ok(Token(start_mark, TokenType::Scalar(TScalarStyle::Foled, string)))
+            Ok(Token(
+                start_mark,
+                TokenType::Scalar(TScalarStyle::Foled, string),
+            ))
         }
     }
 
     fn block_scalar_breaks(&mut self, indent: &mut usize, breaks: &mut String) -> ScanResult {
         let mut max_indent = 0;
         loop {
             self.lookahead(1);
-            while (*indent == 0 || self.mark.col < *indent)
-                && self.buffer[0] == ' ' {
-                    self.skip();
-                    self.lookahead(1);
+            while (*indent == 0 || self.mark.col < *indent) && self.buffer[0] == ' ' {
+                self.skip();
+                self.lookahead(1);
             }
 
             if self.mark.col > max_indent {
                 max_indent = self.mark.col;
             }
 
             // Check for a tab character messing the intendation.
-            if (*indent == 0 || self.mark.col < *indent)
-                && self.buffer[0] == '\t' {
+            if (*indent == 0 || self.mark.col < *indent) && self.buffer[0] == '\t' {
                 return Err(ScanError::new(self.mark,
                         "while scanning a block scalar, found a tab character where an intendation space is expected"));
             }
 
             if !is_break(self.ch()) {
                 break;
             }
 
@@ -1201,49 +1269,52 @@ impl<T: Iterator<Item=char>> Scanner<T> 
 
         /* Eat the left quote. */
         self.skip();
 
         loop {
             /* Check for a document indicator. */
             self.lookahead(4);
 
-            if self.mark.col == 0 &&
-                (((self.buffer[0] == '-') &&
-                (self.buffer[1] == '-') &&
-                (self.buffer[2] == '-')) ||
-                ((self.buffer[0] == '.') &&
-                (self.buffer[1] == '.') &&
-                (self.buffer[2] == '.'))) &&
-                is_blankz(self.buffer[3]) {
-                    return Err(ScanError::new(start_mark,
-                        "while scanning a quoted scalar, found unexpected document indicator"));
-                }
+            if self.mark.col == 0
+                && (((self.buffer[0] == '-') && (self.buffer[1] == '-') && (self.buffer[2] == '-'))
+                    || ((self.buffer[0] == '.')
+                        && (self.buffer[1] == '.')
+                        && (self.buffer[2] == '.')))
+                && is_blankz(self.buffer[3])
+            {
+                return Err(ScanError::new(
+                    start_mark,
+                    "while scanning a quoted scalar, found unexpected document indicator",
+                ));
+            }
 
             if is_z(self.ch()) {
-                    return Err(ScanError::new(start_mark,
-                        "while scanning a quoted scalar, found unexpected end of stream"));
+                return Err(ScanError::new(
+                    start_mark,
+                    "while scanning a quoted scalar, found unexpected end of stream",
+                ));
             }
 
             self.lookahead(2);
 
             leading_blanks = false;
             // Consume non-blank characters.
 
             while !is_blankz(self.ch()) {
                 match self.ch() {
                     // Check for an escaped single quote.
                     '\'' if self.buffer[1] == '\'' && single => {
                         string.push('\'');
                         self.skip();
                         self.skip();
-                    },
+                    }
                     // Check for the right quote.
-                    '\'' if single => { break; },
-                    '"' if !single => { break; },
+                    '\'' if single => break,
+                    '"' if !single => break,
                     // Check for an escaped line break.
                     '\\' if !single && is_break(self.buffer[1]) => {
                         self.lookahead(3);
                         self.skip();
                         self.skip_line();
                         leading_blanks = true;
                         break;
                     }
@@ -1270,18 +1341,22 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                             '_' => string.push(char::from_u32(0xA0).unwrap()),
                             // LS (#x2028)
                             'L' => string.push(char::from_u32(0x2028).unwrap()),
                             // PS (#x2029)
                             'P' => string.push(char::from_u32(0x2029).unwrap()),
                             'x' => code_length = 2,
                             'u' => code_length = 4,
                             'U' => code_length = 8,
-                            _ => return Err(ScanError::new(start_mark,
-                                    "while parsing a quoted scalar, found unknown escape character"))
+                            _ => {
+                                return Err(ScanError::new(
+                                    start_mark,
+                                    "while parsing a quoted scalar, found unknown escape character",
+                                ))
+                            }
                         }
                         self.skip();
                         self.skip();
                         // Consume an arbitrary escape code.
                         if code_length > 0 {
                             self.lookahead(code_length);
                             let mut value = 0u32;
                             for i in 0..code_length {
@@ -1300,25 +1375,28 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                                 }
                             };
                             string.push(ch);
 
                             for _ in 0..code_length {
                                 self.skip();
                             }
                         }
-                    },
-                    c => { string.push(c); self.skip(); }
+                    }
+                    c => {
+                        string.push(c);
+                        self.skip();
+                    }
                 }
                 self.lookahead(2);
             }
             self.lookahead(1);
             match self.ch() {
-                '\'' if single => { break; },
-                '"' if !single => { break; },
+                '\'' if single => break,
+                '"' if !single => break,
                 _ => {}
             }
 
             // Consume blank characters.
             while is_blank(self.ch()) || is_break(self.ch()) {
                 if is_blank(self.ch()) {
                     // Consume a space or a tab character.
                     if leading_blanks {
@@ -1361,19 +1439,25 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                 whitespaces.clear();
             }
         } // loop
 
         // Eat the right quote.
         self.skip();
 
         if single {
-            Ok(Token(start_mark, TokenType::Scalar(TScalarStyle::SingleQuoted, string)))
+            Ok(Token(
+                start_mark,
+                TokenType::Scalar(TScalarStyle::SingleQuoted, string),
+            ))
         } else {
-            Ok(Token(start_mark, TokenType::Scalar(TScalarStyle::DoubleQuoted, string)))
+            Ok(Token(
+                start_mark,
+                TokenType::Scalar(TScalarStyle::DoubleQuoted, string),
+            ))
         }
     }
 
     fn fetch_plain_scalar(&mut self) -> ScanResult {
         try!(self.save_simple_key());
         self.disallow_simple_key();
 
         let tok = try!(self.scan_plain_scalar());
@@ -1391,38 +1475,40 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         let mut trailing_breaks = String::new();
         let mut whitespaces = String::new();
         let mut leading_blanks = false;
 
         loop {
             /* Check for a document indicator. */
             self.lookahead(4);
 
-            if self.mark.col == 0 &&
-                (((self.buffer[0] == '-') &&
-                 (self.buffer[1] == '-') &&
-                 (self.buffer[2] == '-')) ||
-                    ((self.buffer[0] == '.') &&
-                     (self.buffer[1] == '.') &&
-                     (self.buffer[2] == '.'))) &&
-                    is_blankz(self.buffer[3]) {
-                        break;
-                    }
+            if self.mark.col == 0
+                && (((self.buffer[0] == '-') && (self.buffer[1] == '-') && (self.buffer[2] == '-'))
+                    || ((self.buffer[0] == '.')
+                        && (self.buffer[1] == '.')
+                        && (self.buffer[2] == '.')))
+                && is_blankz(self.buffer[3])
+            {
+                break;
+            }
 
-            if self.ch() == '#' { break; }
+            if self.ch() == '#' {
+                break;
+            }
             while !is_blankz(self.ch()) {
-                if self.flow_level > 0 && self.ch() == ':'
-                    && is_blankz(self.ch()) {
-                        return Err(ScanError::new(start_mark,
-                                                  "while scanning a plain scalar, found unexpected ':'"));
-                    }
+                if self.flow_level > 0 && self.ch() == ':' && is_blankz(self.ch()) {
+                    return Err(ScanError::new(
+                        start_mark,
+                        "while scanning a plain scalar, found unexpected ':'",
+                    ));
+                }
                 // indicators ends a plain scalar
                 match self.ch() {
                     ':' if is_blankz(self.buffer[1]) => break,
-                    ',' | ':' | '?' | '[' | ']' |'{' |'}' if self.flow_level > 0 => break,
+                    ',' | ':' | '?' | '[' | ']' | '{' | '}' if self.flow_level > 0 => break,
                     _ => {}
                 }
 
                 if leading_blanks || !whitespaces.is_empty() {
                     if leading_blanks {
                         if leading_break.is_empty() {
                             string.push_str(&leading_break);
                             string.push_str(&trailing_breaks);
@@ -1431,39 +1517,41 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                         } else {
                             if trailing_breaks.is_empty() {
                                 string.push(' ');
                             } else {
                                 string.push_str(&trailing_breaks);
                                 trailing_breaks.clear();
                             }
                             leading_break.clear();
-
                         }
                         leading_blanks = false;
                     } else {
                         string.push_str(&whitespaces);
                         whitespaces.clear();
                     }
                 }
 
                 string.push(self.ch());
                 self.skip();
                 self.lookahead(2);
             }
             // is the end?
-            if !(is_blank(self.ch()) || is_break(self.ch())) { break; }
+            if !(is_blank(self.ch()) || is_break(self.ch())) {
+                break;
+            }
             self.lookahead(1);
 
             while is_blank(self.ch()) || is_break(self.ch()) {
                 if is_blank(self.ch()) {
-                    if leading_blanks && (self.mark.col as isize) < indent
-                        && self.ch() == '\t' {
-                            return Err(ScanError::new(start_mark,
-                                "while scanning a plain scalar, found a tab"));
+                    if leading_blanks && (self.mark.col as isize) < indent && self.ch() == '\t' {
+                        return Err(ScanError::new(
+                            start_mark,
+                            "while scanning a plain scalar, found a tab",
+                        ));
                     }
 
                     if leading_blanks {
                         self.skip();
                     } else {
                         whitespaces.push(self.ch());
                         self.skip();
                     }
@@ -1486,28 +1574,38 @@ impl<T: Iterator<Item=char>> Scanner<T> 
                 break;
             }
         }
 
         if leading_blanks {
             self.allow_simple_key();
         }
 
-        Ok(Token(start_mark, TokenType::Scalar(TScalarStyle::Plain, string)))
+        Ok(Token(
+            start_mark,
+            TokenType::Scalar(TScalarStyle::Plain, string),
+        ))
     }
 
     fn fetch_key(&mut self) -> ScanResult {
         let start_mark = self.mark;
         if self.flow_level == 0 {
             // Check if we are allowed to start a new key (not nessesary simple).
             if !self.simple_key_allowed {
-                return Err(ScanError::new(self.mark, "mapping keys are not allowed in this context"));
+                return Err(ScanError::new(
+                    self.mark,
+                    "mapping keys are not allowed in this context",
+                ));
             }
-            self.roll_indent(start_mark.col, None,
-                TokenType::BlockMappingStart, start_mark);
+            self.roll_indent(
+                start_mark.col,
+                None,
+                TokenType::BlockMappingStart,
+                start_mark,
+            );
         }
 
         try!(self.remove_simple_key());
 
         if self.flow_level == 0 {
             self.allow_simple_key();
         } else {
             self.disallow_simple_key();
@@ -1523,58 +1621,67 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         let start_mark = self.mark;
         if sk.possible {
             // insert simple key
             let tok = Token(sk.mark, TokenType::Key);
             let tokens_parsed = self.tokens_parsed;
             self.insert_token(sk.token_number - tokens_parsed, tok);
 
             // Add the BLOCK-MAPPING-START token if needed.
-            self.roll_indent(sk.mark.col, Some(sk.token_number),
-                TokenType::BlockMappingStart, start_mark);
+            self.roll_indent(
+                sk.mark.col,
+                Some(sk.token_number),
+                TokenType::BlockMappingStart,
+                start_mark,
+            );
 
             self.simple_keys.last_mut().unwrap().possible = false;
             self.disallow_simple_key();
         } else {
             // The ':' indicator follows a complex key.
             if self.flow_level == 0 {
                 if !self.simple_key_allowed {
-                    return Err(ScanError::new(start_mark,
-                        "mapping values are not allowed in this context"));
+                    return Err(ScanError::new(
+                        start_mark,
+                        "mapping values are not allowed in this context",
+                    ));
                 }
 
-                self.roll_indent(start_mark.col, None,
-                    TokenType::BlockMappingStart, start_mark);
+                self.roll_indent(
+                    start_mark.col,
+                    None,
+                    TokenType::BlockMappingStart,
+                    start_mark,
+                );
             }
 
             if self.flow_level == 0 {
                 self.allow_simple_key();
             } else {
                 self.disallow_simple_key();
             }
         }
         self.skip();
         self.tokens.push_back(Token(start_mark, TokenType::Value));
 
         Ok(())
     }
 
-    fn roll_indent(&mut self, col: usize, number: Option<usize>,
-                   tok: TokenType, mark: Marker) {
+    fn roll_indent(&mut self, col: usize, number: Option<usize>, tok: TokenType, mark: Marker) {
         if self.flow_level > 0 {
             return;
         }
 
         if self.indent < col as isize {
             self.indents.push(self.indent);
             self.indent = col as isize;
             let tokens_parsed = self.tokens_parsed;
             match number {
                 Some(n) => self.insert_token(n - tokens_parsed, Token(mark, tok)),
-                None => self.tokens.push_back(Token(mark, tok))
+                None => self.tokens.push_back(Token(mark, tok)),
             }
         }
     }
 
     fn unroll_indent(&mut self, col: isize) {
         if self.flow_level > 0 {
             return;
         }
@@ -1604,54 +1711,51 @@ impl<T: Iterator<Item=char>> Scanner<T> 
         let last = self.simple_keys.last_mut().unwrap();
         if last.possible && last.required {
             return Err(ScanError::new(self.mark, "simple key expected"));
         }
 
         last.possible = false;
         Ok(())
     }
-
 }
 
 #[cfg(test)]
 mod test {
+    use super::TokenType::*;
     use super::*;
-    use super::TokenType::*;
 
-macro_rules! next {
-    ($p:ident, $tk:pat) => {{
-        let tok = $p.next().unwrap();
-        match tok.1 {
-            $tk => {},
-            _ => { panic!("unexpected token: {:?}",
-                    tok) }
-        }
-    }}
-}
+    macro_rules! next {
+        ($p:ident, $tk:pat) => {{
+            let tok = $p.next().unwrap();
+            match tok.1 {
+                $tk => {}
+                _ => panic!("unexpected token: {:?}", tok),
+            }
+        }};
+    }
 
-macro_rules! next_scalar {
-    ($p:ident, $tk:expr, $v:expr) => {{
-        let tok = $p.next().unwrap();
-        match tok.1 {
-            Scalar(style, ref v) => {
-                assert_eq!(style, $tk);
-                assert_eq!(v, $v);
-            },
-            _ => { panic!("unexpected token: {:?}",
-                    tok) }
-        }
-    }}
-}
+    macro_rules! next_scalar {
+        ($p:ident, $tk:expr, $v:expr) => {{
+            let tok = $p.next().unwrap();
+            match tok.1 {
+                Scalar(style, ref v) => {
+                    assert_eq!(style, $tk);
+                    assert_eq!(v, $v);
+                }
+                _ => panic!("unexpected token: {:?}", tok),
+            }
+        }};
+    }
 
-macro_rules! end {
-    ($p:ident) => {{
-        assert_eq!($p.next(), None);
-    }}
-}
+    macro_rules! end {
+        ($p:ident) => {{
+            assert_eq!($p.next(), None);
+        }};
+    }
     /// test cases in libyaml scanner.c
     #[test]
     fn test_empty() {
         let s = "";
         let mut p = Scanner::new(s.chars());
         next!(p, StreamStart(..));
         next!(p, StreamEnd);
         end!(p);
@@ -1664,34 +1768,32 @@ macro_rules! end {
         next!(p, StreamStart(..));
         next!(p, Scalar(TScalarStyle::Plain, _));
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_explicit_scalar() {
-        let s =
-"---
+        let s = "---
 'a scalar'
 ...
 ";
         let mut p = Scanner::new(s.chars());
         next!(p, StreamStart(..));
         next!(p, DocumentStart);
         next!(p, Scalar(TScalarStyle::SingleQuoted, _));
         next!(p, DocumentEnd);
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_multiple_documents() {
-        let s =
-"
+        let s = "
 'a scalar'
 ---
 'a scalar'
 ---
 'a scalar'
 ";
         let mut p = Scanner::new(s.chars());
         next!(p, StreamStart(..));
@@ -1717,18 +1819,17 @@ macro_rules! end {
         next!(p, Scalar(TScalarStyle::Plain, _));
         next!(p, FlowSequenceEnd);
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_a_flow_mapping() {
-        let s =
-"
+        let s = "
 {
     a simple key: a value, # Note that the KEY token is produced.
     ? a complex key: another value,
 }
 ";
         let mut p = Scanner::new(s.chars());
         next!(p, StreamStart(..));
         next!(p, FlowMappingStart);
@@ -1744,18 +1845,17 @@ macro_rules! end {
         next!(p, FlowEntry);
         next!(p, FlowMappingEnd);
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_block_sequences() {
-        let s =
-"
+        let s = "
 - item 1
 - item 2
 -
   - item 3.1
   - item 3.2
 -
   key 1: value 1
   key 2: value 2
@@ -1787,18 +1887,17 @@ macro_rules! end {
         next!(p, BlockEnd);
         next!(p, BlockEnd);
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_block_mappings() {
-        let s =
-"
+        let s = "
 a simple key: a value   # The KEY token is produced here.
 ? a complex key
 : another value
 a mapping:
   key 1: value 1
   key 2: value 2
 a sequence:
   - item 1
@@ -1835,23 +1934,21 @@ a sequence:
         next!(p, BlockEntry);
         next!(p, Scalar(_, _));
         next!(p, BlockEntry);
         next!(p, Scalar(_, _));
         next!(p, BlockEnd);
         next!(p, BlockEnd);
         next!(p, StreamEnd);
         end!(p);
-
     }
 
     #[test]
     fn test_no_block_sequence_start() {
-        let s =
-"
+        let s = "
 key:
 - item 1
 - item 2
 ";
         let mut p = Scanner::new(s.chars());
         next!(p, StreamStart(..));
         next!(p, BlockMappingStart);
         next!(p, Key);
@@ -1863,18 +1960,17 @@ key:
         next_scalar!(p, TScalarStyle::Plain, "item 2");
         next!(p, BlockEnd);
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_collections_in_sequence() {
-        let s =
-"
+        let s = "
 - - item 1
   - item 2
 - key 1: value 1
   key 2: value 2
 - ? complex key
   : complex value
 ";
         let mut p = Scanner::new(s.chars());
@@ -1907,18 +2003,17 @@ key:
         next!(p, BlockEnd);
         next!(p, BlockEnd);
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_collections_in_mapping() {
-        let s =
-"
+        let s = "
 ? a sequence
 : - item 1
   - item 2
 ? a mapping
 : key 1: value 1
   key 2: value 2
 ";
         let mut p = Scanner::new(s.chars());
@@ -1948,18 +2043,17 @@ key:
         next!(p, BlockEnd);
         next!(p, BlockEnd);
         next!(p, StreamEnd);
         end!(p);
     }
 
     #[test]
     fn test_spec_ex7_3() {
-        let s =
-"
+        let s = "
 {
     ? foo :,
     : bar,
 }
 ";
         let mut p = Scanner::new(s.chars());
         next!(p, StreamStart(..));
         next!(p, FlowMappingStart);
--- a/third_party/rust/yaml-rust/src/yaml.rs
+++ b/third_party/rust/yaml-rust/src/yaml.rs
@@ -1,18 +1,18 @@
+use linked_hash_map::LinkedHashMap;
+use parser::*;
+use scanner::{Marker, ScanError, TScalarStyle, TokenType};
 use std::collections::BTreeMap;
+use std::f64;
+use std::i64;
+use std::mem;
 use std::ops::Index;
 use std::string;
-use std::i64;
-use std::f64;
-use std::mem;
 use std::vec;
-use parser::*;
-use scanner::{TScalarStyle, ScanError, TokenType, Marker};
-use linked_hash_map::LinkedHashMap;
 
 /// A YAML node is stored as this `Yaml` enumeration, which provides an easy way to
 /// access your YAML document.
 ///
 /// # Examples
 ///
 /// ```
 /// use yaml_rust::Yaml;
@@ -57,17 +57,17 @@ pub type Hash = LinkedHashMap<Yaml, Yaml
 
 // parse f64 as Core schema
 // See: https://github.com/chyh1990/yaml-rust/issues/51
 fn parse_f64(v: &str) -> Option<f64> {
     match v {
         ".inf" | ".Inf" | ".INF" | "+.inf" | "+.Inf" | "+.INF" => Some(f64::INFINITY),
         "-.inf" | "-.Inf" | "-.INF" => Some(f64::NEG_INFINITY),
         ".nan" | "NaN" | ".NAN" => Some(f64::NAN),
-        _ => v.parse::<f64>().ok()
+        _ => v.parse::<f64>().ok(),
     }
 }
 
 pub struct YamlLoader {
     docs: Vec<Yaml>,
     // states
     // (current node, anchor_id) tuple
     doc_stack: Vec<(Yaml, usize)>,
@@ -76,85 +76,79 @@ pub struct YamlLoader {
 }
 
 impl MarkedEventReceiver for YamlLoader {
     fn on_event(&mut self, ev: Event, _: Marker) {
         // println!("EV {:?}", ev);
         match ev {
             Event::DocumentStart => {
                 // do nothing
-            },
+            }
             Event::DocumentEnd => {
                 match self.doc_stack.len() {
                     // empty document
                     0 => self.docs.push(Yaml::BadValue),
                     1 => self.docs.push(self.doc_stack.pop().unwrap().0),
-                    _ => unreachable!()
+                    _ => unreachable!(),
                 }
-            },
+            }
             Event::SequenceStart(aid) => {
                 self.doc_stack.push((Yaml::Array(Vec::new()), aid));
-            },
+            }
             Event::SequenceEnd => {
                 let node = self.doc_stack.pop().unwrap();
                 self.insert_new_node(node);
-            },
+            }
             Event::MappingStart(aid) => {
                 self.doc_stack.push((Yaml::Hash(Hash::new()), aid));
                 self.key_stack.push(Yaml::BadValue);
-            },
+            }
             Event::MappingEnd => {
                 self.key_stack.pop().unwrap();
                 let node = self.doc_stack.pop().unwrap();
                 self.insert_new_node(node);
-            },
+            }
             Event::Scalar(v, style, aid, tag) => {
                 let node = if style != TScalarStyle::Plain {
                     Yaml::String(v)
                 } else if let Some(TokenType::Tag(ref handle, ref suffix)) = tag {
                     // XXX tag:yaml.org,2002:
                     if handle == "!!" {
                         match suffix.as_ref() {
                             "bool" => {
                                 // "true" or "false"
                                 match v.parse::<bool>() {
                                     Err(_) => Yaml::BadValue,
-                                    Ok(v) => Yaml::Boolean(v)
-                                }
-                            },
-                            "int" => {
-                                match v.parse::<i64>() {
-                                    Err(_) => Yaml::BadValue,
-                                    Ok(v) => Yaml::Integer(v)
-                                }
-                            },
-                            "float" => {
-                                match parse_f64(&v) {
-                                    Some(_) => Yaml::Real(v),
-                                    None => Yaml::BadValue,
-                                }
-                            },
-                            "null" => {
-                                match v.as_ref() {
-                                    "~" | "null" => Yaml::Null,
-                                    _ => Yaml::BadValue,
+                                    Ok(v) => Yaml::Boolean(v),
                                 }
                             }
-                            _  => Yaml::String(v),
+                            "int" => match v.parse::<i64>() {
+                                Err(_) => Yaml::BadValue,
+                                Ok(v) => Yaml::Integer(v),
+                            },
+                            "float" => match parse_f64(&v) {
+                                Some(_) => Yaml::Real(v),
+                                None => Yaml::BadValue,
+                            },
+                            "null" => match v.as_ref() {
+                                "~" | "null" => Yaml::Null,
+                                _ => Yaml::BadValue,
+                            },
+                            _ => Yaml::String(v),
                         }
                     } else {
                         Yaml::String(v)
                     }
                 } else {
                     // Datatype is not specified, or unrecognized
                     Yaml::from_str(&v)
                 };
 
                 self.insert_new_node((node, aid));
-            },
+            }
             Event::Alias(id) => {
                 let n = match self.anchor_map.get(&id) {
                     Some(v) => v.clone(),
                     None => Yaml::BadValue,
                 };
                 self.insert_new_node((n, 0));
             }
             _ => { /* ignore */ }
@@ -171,33 +165,33 @@ impl YamlLoader {
         }
         if self.doc_stack.is_empty() {
             self.doc_stack.push(node);
         } else {
             let parent = self.doc_stack.last_mut().unwrap();
             match *parent {
                 (Yaml::Array(ref mut v), _) => v.push(node.0),
                 (Yaml::Hash(ref mut h), _) => {
-                    let mut cur_key = self.key_stack.last_mut().unwrap();
+                    let cur_key = self.key_stack.last_mut().unwrap();
                     // current node is a key
                     if cur_key.is_badvalue() {
                         *cur_key = node.0;
                     // current node is a value
                     } else {
                         let mut newkey = Yaml::BadValue;
                         mem::swap(&mut newkey, cur_key);
                         h.insert(newkey, node.0);
                     }
-                },
+                }
                 _ => unreachable!(),
             }
         }
     }
 
-    pub fn load_from_str(source: &str) -> Result<Vec<Yaml>, ScanError>{
+    pub fn load_from_str(source: &str) -> Result<Vec<Yaml>, ScanError> {
         let mut loader = YamlLoader {
             docs: Vec::new(),
             doc_stack: Vec::new(),
             key_stack: Vec::new(),
             anchor_map: BTreeMap::new(),
         };
         let mut parser = Parser::new(source.chars());
         try!(parser.load(&mut loader, true));
@@ -250,45 +244,45 @@ impl Yaml {
     define_into!(into_i64, i64, Integer);
     define_into!(into_string, String, String);
     define_into!(into_hash, Hash, Hash);
     define_into!(into_vec, Array, Array);
 
     pub fn is_null(&self) -> bool {
         match *self {
             Yaml::Null => true,
-            _ => false
+            _ => false,
         }
     }
 
     pub fn is_badvalue(&self) -> bool {
         match *self {
             Yaml::BadValue => true,
-            _ => false
+            _ => false,
         }
     }
 
     pub fn is_array(&self) -> bool {
         match *self {
             Yaml::Array(_) => true,
-            _ => false
+            _ => false,
         }
     }
 
     pub fn as_f64(&self) -> Option<f64> {
         match *self {
             Yaml::Real(ref v) => parse_f64(v),
-            _ => None
+            _ => None,
         }
     }
 
     pub fn into_f64(self) -> Option<f64> {
         match self {
             Yaml::Real(ref v) => parse_f64(v),
-            _ => None
+            _ => None,
         }
     }
 }
 
 #[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
 impl Yaml {
     // Not implementing FromStr because there is no possibility of Error.
     // This function falls back to Yaml::String if nothing else matches.
@@ -310,30 +304,30 @@ impl Yaml {
         }
         match v {
             "~" | "null" => Yaml::Null,
             "true" => Yaml::Boolean(true),
             "false" => Yaml::Boolean(false),
             _ if v.parse::<i64>().is_ok() => Yaml::Integer(v.parse::<i64>().unwrap()),
             // try parsing as f64
             _ if parse_f64(v).is_some() => Yaml::Real(v.to_owned()),
-            _ => Yaml::String(v.to_owned())
+            _ => Yaml::String(v.to_owned()),
         }
     }
 }
 
 static BAD_VALUE: Yaml = Yaml::BadValue;
 impl<'a> Index<&'a str> for Yaml {
     type Output = Yaml;
 
     fn index(&self, idx: &'a str) -> &Yaml {
         let key = Yaml::String(idx.to_owned());
         match self.as_hash() {
             Some(h) => h.get(&key).unwrap_or(&BAD_VALUE),
-            None => &BAD_VALUE
+            None => &BAD_VALUE,
         }
     }
 }
 
 impl Index<usize> for Yaml {
     type Output = Yaml;
 
     fn index(&self, idx: usize) -> &Yaml {
@@ -349,18 +343,17 @@ impl Index<usize> for Yaml {
 }
 
 impl IntoIterator for Yaml {
     type Item = Yaml;
     type IntoIter = YamlIter;
 
     fn into_iter(self) -> Self::IntoIter {
         YamlIter {
-            yaml: self.into_vec()
-                .unwrap_or_else(Vec::new).into_iter()
+            yaml: self.into_vec().unwrap_or_else(Vec::new).into_iter(),
         }
     }
 }
 
 pub struct YamlIter {
     yaml: vec::IntoIter<Yaml>,
 }
 
@@ -369,18 +362,18 @@ impl Iterator for YamlIter {
 
     fn next(&mut self) -> Option<Yaml> {
         self.yaml.next()
     }
 }
 
 #[cfg(test)]
 mod test {
+    use std::f64;
     use yaml::*;
-    use std::f64;
     #[test]
     fn test_coerce() {
         let s = "---
 a: 1
 b: 2.2
 c: [1, 2]
 ";
         let out = YamlLoader::load_from_str(&s).unwrap();
@@ -419,69 +412,64 @@ a7: 你好
 ".to_owned();
         let out = YamlLoader::load_from_str(&s).unwrap();
         let doc = &out[0];
         assert_eq!(doc["a7"].as_str().unwrap(), "你好");
     }
 
     #[test]
     fn test_multi_doc() {
-        let s =
-"
+        let s = "
 'a scalar'
 ---
 'a scalar'
 ---
 'a scalar'
 ";
         let out = YamlLoader::load_from_str(&s).unwrap();
         assert_eq!(out.len(), 3);
     }
 
     #[test]
     fn test_anchor() {
-        let s =
-"
+        let s = "
 a1: &DEFAULT
     b1: 4
     b2: d
 a2: *DEFAULT
 ";
         let out = YamlLoader::load_from_str(&s).unwrap();
         let doc = &out[0];
         assert_eq!(doc["a2"]["b1"].as_i64().unwrap(), 4);
     }
 
     #[test]
     fn test_bad_anchor() {
-        let s =
-"
+        let s = "
 a1: &DEFAULT
     b1: 4
     b2: *DEFAULT
 ";
         let out = YamlLoader::load_from_str(&s).unwrap();
         let doc = &out[0];
         assert_eq!(doc["a1"]["b2"], Yaml::BadValue);
-
     }
 
     #[test]
     fn test_github_27() {
         // https://github.com/chyh1990/yaml-rust/issues/27
         let s = "&a";
         let out = YamlLoader::load_from_str(&s).unwrap();
         let doc = &out[0];
         assert_eq!(doc.as_str().unwrap(), "");
     }
 
     #[test]
     fn test_plain_datatype() {
-        let s =
-"
+        let s = "
 - 'string'
 - \"string\"
 - string
 - 123
 - -321
 - 1.23
 - -1e4
 - ~
@@ -550,25 +538,33 @@ a1: &DEFAULT
         // See: https://github.com/chyh1990/yaml-rust/issues/65
         let b = "\n\"ll\\\"ll\\\r\n\"ll\\\"ll\\\r\r\r\rU\r\r\rU";
         assert!(YamlLoader::load_from_str(&b).is_err());
     }
 
     #[test]
     fn test_bad_docstart() {
         assert!(YamlLoader::load_from_str("---This used to cause an infinite loop").is_ok());
-        assert_eq!(YamlLoader::load_from_str("----"), Ok(vec![Yaml::String(String::from("----"))]));
-        assert_eq!(YamlLoader::load_from_str("--- #here goes a comment"), Ok(vec![Yaml::Null]));
-        assert_eq!(YamlLoader::load_from_str("---- #here goes a comment"), Ok(vec![Yaml::String(String::from("----"))]));
+        assert_eq!(
+            YamlLoader::load_from_str("----"),
+            Ok(vec![Yaml::String(String::from("----"))])
+        );
+        assert_eq!(
+            YamlLoader::load_from_str("--- #here goes a comment"),
+            Ok(vec![Yaml::Null])
+        );
+        assert_eq!(
+            YamlLoader::load_from_str("---- #here goes a comment"),
+            Ok(vec![Yaml::String(String::from("----"))])
+        );
     }
 
     #[test]
     fn test_plain_datatype_with_into_methods() {
-        let s =
-"
+        let s = "
 - 'string'
 - \"string\"
 - string
 - 123
 - -321
 - 1.23
 - -1e4
 - true
@@ -615,27 +611,124 @@ a1: &DEFAULT
         let s = "---
 b: ~
 a: ~
 c: ~
 ";
         let out = YamlLoader::load_from_str(&s).unwrap();
         let first = out.into_iter().next().unwrap();
         let mut iter = first.into_hash().unwrap().into_iter();
-        assert_eq!(Some((Yaml::String("b".to_owned()), Yaml::Null)), iter.next());
-        assert_eq!(Some((Yaml::String("a".to_owned()), Yaml::Null)), iter.next());
-        assert_eq!(Some((Yaml::String("c".to_owned()), Yaml::Null)), iter.next());
+        assert_eq!(
+            Some((Yaml::String("b".to_owned()), Yaml::Null)),
+            iter.next()
+        );
+        assert_eq!(
+            Some((Yaml::String("a".to_owned()), Yaml::Null)),
+            iter.next()
+        );
+        assert_eq!(
+            Some((Yaml::String("c".to_owned()), Yaml::Null)),
+            iter.next()
+        );
         assert_eq!(None, iter.next());
     }
 
     #[test]
     fn test_integer_key() {
         let s = "
 0:
     important: true
 1:
     important: false
 ";
         let out = YamlLoader::load_from_str(&s).unwrap();
         let first = out.into_iter().next().unwrap();
         assert_eq!(first[0]["important"].as_bool().unwrap(), true);
     }
+
+    #[test]
+    fn test_indentation_equality() {
+        let four_spaces = YamlLoader::load_from_str(
+            r#"
+hash:
+    with:
+        indentations
+"#,
+        ).unwrap()
+        .into_iter()
+        .next()
+        .unwrap();
+
+        let two_spaces = YamlLoader::load_from_str(
+            r#"
+hash:
+  with:
+    indentations
+"#,
+        ).unwrap()
+        .into_iter()
+        .next()
+        .unwrap();
+
+        let one_space = YamlLoader::load_from_str(
+            r#"
+hash:
+ with:
+  indentations
+"#,
+        ).unwrap()
+        .into_iter()
+        .next()
+        .unwrap();
+
+        let mixed_spaces = YamlLoader::load_from_str(
+            r#"
+hash:
+     with:
+               indentations
+"#,
+        ).unwrap()
+        .into_iter()
+        .next()
+        .unwrap();
+
+        assert_eq!(four_spaces, two_spaces);
+        assert_eq!(two_spaces, one_space);
+        assert_eq!(four_spaces, mixed_spaces);
+    }
+
+    #[test]
+    fn test_two_space_indentations() {
+        // https://github.com/kbknapp/clap-rs/issues/965
+
+        let s = r#"
+subcommands:
+  - server:
+    about: server related commands
+subcommands2:
+  - server:
+      about: server related commands
+subcommands3:
+ - server:
+    about: server related commands
+            "#;
+
+        let out = YamlLoader::load_from_str(&s).unwrap();
+        let doc = &out.into_iter().next().unwrap();
+
+        println!("{:#?}", doc);
+        assert_eq!(doc["subcommands"][0]["server"], Yaml::Null);
+        assert!(doc["subcommands2"][0]["server"].as_hash().is_some());
+        assert!(doc["subcommands3"][0]["server"].as_hash().is_some());
+    }
+
+    #[test]
+    fn test_recursion_depth_check_objects() {
+        let s = "{a:".repeat(10_000) + &"}".repeat(10_000);
+        assert!(YamlLoader::load_from_str(&s).is_err());
+    }
+
+    #[test]
+    fn test_recursion_depth_check_arrays() {
+        let s = "[".repeat(10_000) + &"]".repeat(10_000);
+        assert!(YamlLoader::load_from_str(&s).is_err());
+    }
 }
--- a/third_party/rust/yaml-rust/tests/quickcheck.rs
+++ b/third_party/rust/yaml-rust/tests/quickcheck.rs
@@ -1,21 +1,22 @@
 extern crate yaml_rust;
 #[macro_use]
 extern crate quickcheck;
 
 use quickcheck::TestResult;
-use yaml_rust::{Yaml, YamlLoader, YamlEmitter};
 use std::error::Error;
+use yaml_rust::{Yaml, YamlEmitter, YamlLoader};
 
 quickcheck! {
     fn test_check_weird_keys(xs: Vec<String>) -> TestResult {
         let mut out_str = String::new();
+        let input = Yaml::Array(xs.into_iter().map(Yaml::String).collect());
         {
             let mut emitter = YamlEmitter::new(&mut out_str);
-            emitter.dump(&Yaml::Array(xs.into_iter().map(Yaml::String).collect())).unwrap();
+            emitter.dump(&input).unwrap();
         }
-        if let Err(err) = YamlLoader::load_from_str(&out_str) {
-            return TestResult::error(err.description());
+        match YamlLoader::load_from_str(&out_str) {
+            Ok(output) => TestResult::from_bool(output.len() == 1 && input == output[0]),
+            Err(err) => TestResult::error(err.description()),
         }
-        TestResult::passed()
     }
 }
--- a/third_party/rust/yaml-rust/tests/spec_test.rs
+++ b/third_party/rust/yaml-rust/tests/spec_test.rs
@@ -1,13 +1,13 @@
 #![allow(dead_code)]
 #![allow(non_upper_case_globals)]
 extern crate yaml_rust;
 
-use yaml_rust::parser::{Parser, EventReceiver, Event};
+use yaml_rust::parser::{Event, EventReceiver, Parser};
 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,
     OnDocumentEnd,
@@ -16,126 +16,125 @@ enum TestEvent {
     OnMapStart,
     OnMapEnd,
     OnScalar,
     OnAlias,
     OnNull,
 }
 
 struct YamlChecker {
-    pub evs: Vec<TestEvent>
+    pub evs: Vec<TestEvent>,
 }
 
 impl EventReceiver for YamlChecker {
     fn on_event(&mut self, ev: Event) {
         let tev = match ev {
             Event::DocumentStart => TestEvent::OnDocumentStart,
             Event::DocumentEnd => TestEvent::OnDocumentEnd,
             Event::SequenceStart(..) => TestEvent::OnSequenceStart,
             Event::SequenceEnd => TestEvent::OnSequenceEnd,
             Event::MappingStart(..) => TestEvent::OnMapStart,
             Event::MappingEnd => TestEvent::OnMapEnd,
-            Event::Scalar(ref v, style, _, _)=> {
+            Event::Scalar(ref v, style, _, _) => {
                 if v == "~" && style == TScalarStyle::Plain {
                     TestEvent::OnNull
                 } else {
                     TestEvent::OnScalar
                 }
-            },
+            }
             Event::Alias(_) => TestEvent::OnAlias,
-            _ => { return } // ignore other events
+            _ => return, // ignore other events
         };
         self.evs.push(tev);
     }
 }
 
 fn str_to_test_events(docs: &str) -> Vec<TestEvent> {
-    let mut p = YamlChecker {
-        evs: Vec::new()
-    };
+    let mut p = YamlChecker { evs: Vec::new() };
     let mut parser = Parser::new(docs.chars());
     parser.load(&mut p, true).unwrap();
     p.evs
 }
 
 macro_rules! assert_next {
-    ($v:expr, $p:pat) => (
+    ($v:expr, $p:pat) => {
         match $v.next().unwrap() {
-            $p => {},
-            e => { panic!("unexpected event: {:?}", e); }
+            $p => {}
+            e => {
+                panic!("unexpected event: {:?}", e);
+            }
         }
-    )
+    };
 }
 
 // auto generated from handler_spec_test.cpp
 include!("specexamples.rs.inc");
 include!("spec_test.rs.inc");
 
 // hand-crafted tests
 //#[test]
 //fn test_hc_alias() {
 //}
 
 #[test]
 fn test_mapvec_legal() {
-  use yaml_rust::yaml::{Array, Hash, Yaml};
-  use yaml_rust::{YamlLoader, YamlEmitter};
+    use yaml_rust::yaml::{Array, Hash, Yaml};
+    use yaml_rust::{YamlEmitter, YamlLoader};
 
-  // Emitting a `map<map<seq<_>>, _>` should result in legal yaml that
-  // we can parse.
+    // Emitting a `map<map<seq<_>>, _>` should result in legal yaml that
+    // we can parse.
 
-  let mut key = Array::new();
-  key.push(Yaml::Integer(1));
-  key.push(Yaml::Integer(2));
-  key.push(Yaml::Integer(3));
+    let mut key = Array::new();
+    key.push(Yaml::Integer(1));
+    key.push(Yaml::Integer(2));
+    key.push(Yaml::Integer(3));
 
-  let mut keyhash = Hash::new();
-  keyhash.insert(Yaml::String("key".into()), Yaml::Array(key));
+    let mut keyhash = Hash::new();
+    keyhash.insert(Yaml::String("key".into()), Yaml::Array(key));
 
-  let mut val = Array::new();
-  val.push(Yaml::Integer(4));
-  val.push(Yaml::Integer(5));
-  val.push(Yaml::Integer(6));
+    let mut val = Array::new();
+    val.push(Yaml::Integer(4));
+    val.push(Yaml::Integer(5));
+    val.push(Yaml::Integer(6));
 
-  let mut hash = Hash::new();
-  hash.insert(Yaml::Hash(keyhash), Yaml::Array(val));
+    let mut hash = Hash::new();
+    hash.insert(Yaml::Hash(keyhash), Yaml::Array(val));
 
-  let mut out_str = String::new();
-  {
-    let mut emitter = YamlEmitter::new(&mut out_str);
-    emitter.dump(&Yaml::Hash(hash)).unwrap();
-  }
+    let mut out_str = String::new();
+    {
+        let mut emitter = YamlEmitter::new(&mut out_str);
+        emitter.dump(&Yaml::Hash(hash)).unwrap();
+    }
 
-  // At this point, we are tempted to naively render like this:
-  //
-  //  ```yaml
-  //  ---
-  //  {key:
-  //      - 1
-  //      - 2
-  //      - 3}:
-  //    - 4
-  //    - 5
-  //    - 6
-  //  ```
-  //
-  // However, this doesn't work, because the key sequence [1, 2, 3] is
-  // rendered in block mode, which is not legal (as far as I can tell)
-  // inside the flow mode of the key. We need to either fully render
-  // everything that's in a key in flow mode (which may make for some
-  // long lines), or use the explicit map identifier '?': 
-  //
-  //  ```yaml
-  //  ---
-  //  ?
-  //    key:
-  //      - 1
-  //      - 2
-  //      - 3
-  //  :
-  //    - 4
-  //    - 5
-  //    - 6
-  //  ```
+    // At this point, we are tempted to naively render like this:
+    //
+    //  ```yaml
+    //  ---
+    //  {key:
+    //      - 1
+    //      - 2
+    //      - 3}:
+    //    - 4
+    //    - 5
+    //    - 6
+    //  ```
+    //
+    // However, this doesn't work, because the key sequence [1, 2, 3] is
+    // rendered in block mode, which is not legal (as far as I can tell)
+    // inside the flow mode of the key. We need to either fully render
+    // everything that's in a key in flow mode (which may make for some
+    // long lines), or use the explicit map identifier '?':
+    //
+    //  ```yaml
+    //  ---
+    //  ?
+    //    key:
+    //      - 1
+    //      - 2
+    //      - 3
+    //  :
+    //    - 4
+    //    - 5
+    //    - 6
+    //  ```
 
-  YamlLoader::load_from_str(&out_str).unwrap();
+    YamlLoader::load_from_str(&out_str).unwrap();
 }
-
new file mode 100644
--- /dev/null
+++ b/third_party/rust/yaml-rust/tests/test_round_trip.rs
@@ -0,0 +1,23 @@
+extern crate yaml_rust;
+
+use yaml_rust::{Yaml, YamlEmitter, YamlLoader};
+
+fn test_round_trip(original: &Yaml) {
+    let mut out = String::new();
+    YamlEmitter::new(&mut out).dump(original).unwrap();
+    let documents = YamlLoader::load_from_str(&out).unwrap();
+    assert_eq!(documents.len(), 1);
+    assert_eq!(documents[0], *original);
+}
+
+#[test]
+fn test_escape_character() {
+    let y = Yaml::String("\x1b".to_owned());
+    test_round_trip(&y);
+}
+
+#[test]
+fn test_colon_in_string() {
+    let y = Yaml::String("x: %".to_owned());
+    test_round_trip(&y);
+}