Skip to content

Commit

Permalink
Upgrading yaml-rust to 0.4.2. Solving issue clap-rs#1387
Browse files Browse the repository at this point in the history
`cargo test --feature "yaml"` passes
  • Loading branch information
gedigi authored and Gerardo Di Giacomo committed Apr 10, 2019
1 parent 3294d18 commit 033b009
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ maintenance = {status = "actively-developed"}
bitflags = "1.0"
unicode-width = "0.1.4"
textwrap = "0.10.0"
strsim = { version = "0.8", optional = true }
yaml-rust = { version = "0.3.5", optional = true }
clippy = { version = "~0.0.166", optional = true }
atty = { version = "0.2.2", optional = true }
vec_map = { version = "0.8", optional = true }
term_size = { version = "0.3.0", optional = true }
strsim = { version = "0.8", optional = true }
yaml-rust = { version = "0.4.2", optional = true }
linked-hash-map = { version = ">=0.0.9, <0.6", optional = true }
clippy = { version = "~0.0.166", optional = true }
atty = { version = "0.2.2", optional = true }
vec_map = { version = "0.8", optional = true }
term_size = { version = "0.3.0", optional = true }

[target.'cfg(not(windows))'.dependencies]
ansi_term = { version = "0.11", optional = true }
Expand All @@ -48,7 +49,7 @@ default = ["suggestions", "color", "vec_map"]
suggestions = ["strsim"]
color = ["ansi_term", "atty"]
wrap_help = ["term_size", "textwrap/term_size"]
yaml = ["yaml-rust"]
yaml = ["yaml-rust", "linked-hash-map"]
unstable = [] # for building with unstable clap features (doesn't require nightly Rust) (currently none)
nightly = [] # for building with unstable Rust features (currently none)
lints = ["clippy"] # Requires nightly Rust
Expand Down
4 changes: 2 additions & 2 deletions src/args/arg.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "yaml")]
use std::collections::BTreeMap;
use linked_hash_map::LinkedHashMap;
use std::rc::Rc;
use std::ffi::{OsStr, OsString};
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
Expand Down Expand Up @@ -91,7 +91,7 @@ impl<'a, 'b> Arg<'a, 'b> {
/// ```
/// [`Arg`]: ./struct.Arg.html
#[cfg(feature = "yaml")]
pub fn from_yaml(y: &BTreeMap<Yaml, Yaml>) -> Arg {
pub fn from_yaml(y: &LinkedHashMap<Yaml, Yaml>) -> Arg {
// We WANT this to panic on error...so expect() is good.
let name_yml = y.keys().nth(0).unwrap();
let name_str = name_yml.as_str().unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/args/group.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "yaml")]
use std::collections::BTreeMap;
use linked_hash_map::LinkedHashMap;
use std::fmt::{Debug, Formatter, Result};

#[cfg(feature = "yaml")]
Expand Down Expand Up @@ -454,8 +454,8 @@ impl<'a, 'z> From<&'z ArgGroup<'a>> for ArgGroup<'a> {
}

#[cfg(feature = "yaml")]
impl<'a> From<&'a BTreeMap<Yaml, Yaml>> for ArgGroup<'a> {
fn from(b: &'a BTreeMap<Yaml, Yaml>) -> Self {
impl<'a> From<&'a LinkedHashMap<Yaml, Yaml>> for ArgGroup<'a> {
fn from(b: &'a LinkedHashMap<Yaml, Yaml>) -> Self {
// We WANT this to panic on error...so expect() is good.
let mut a = ArgGroup::default();
let group_settings = if b.len() == 1 {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ extern crate unicode_width;
extern crate vec_map;
#[cfg(feature = "yaml")]
extern crate yaml_rust;
#[cfg(feature = "yaml")]
extern crate linked_hash_map;

#[cfg(feature = "yaml")]
pub use yaml_rust::YamlLoader;
Expand Down

0 comments on commit 033b009

Please sign in to comment.