Repository: clap-rs/clap
Pull request #1436 (2019-03-21 21:23:15)

Remove bitflags dependency
The only real use of bitflags was to save a tiny bit of memory. It isn't
exposed externally and we can just use a flag enumeration combined with
a HashSet to replace it. Because of this, let's not subject this
dependency to all projects which depend on clap.

spacekookie: This isn't really something we can merge against `master` because of the breaking change.
npmccallum: 1. What breaking change? All the type and code changes are internal.
2. Where do you merge breaking changes besides `master`?
spacekookie: Ah, apologies, your description of the change made it sound this was something re-exported to depending crates. Generally breaking changes are being made on `v3-master` and `v3-dev`.

So...I don't really have an opinion on merging this. I will leave it open for a bit longer to let other maintainers voice concerns if they have them, otherwise merge it in a few days.
npmccallum: @spacekookie Should I make separate pull requests against `v3-master`/`v3-dev`?
BurntSushi: I'm not involved in clap development, but I definitely appreciate reducing my dependency list when something isn't carrying its weight. :-) I've been trying to do the same for my crates.
spacekookie: @npmccallum  `v3-master` seems to be the correct place, yea. If the dependency is still present, feel free to open another PR for its removal

Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 6d56e0fc..ede34f66 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,16 +24,14 @@ is-it-maintained-open-issues = { repository = "clap-rs/clap" }
 maintenance = {status = "actively-developed"}
 
 [dependencies]
-bitflags              = "1.0"
 unicode-width         = "0.1.4"
 textwrap              = "0.10.0"
-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 }
+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 }
 
 [target.'cfg(not(windows))'.dependencies]
 ansi_term = { version = "0.11",  optional = true }
@@ -49,7 +47,7 @@ default     = ["suggestions", "color", "vec_map"]
 suggestions = ["strsim"]
 color       = ["ansi_term", "atty"]
 wrap_help   = ["term_size", "textwrap/term_size"]
-yaml        = ["yaml-rust", "linked-hash-map"]
+yaml        = ["yaml-rust"]
 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
diff --git a/README.md b/README.md
index 04d1f115..665007e6 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 clap
 ====
 
-[![Crates.io](https://img.shields.io/crates/v/clap.svg)](https://crates.io/crates/clap) [![Crates.io](https://img.shields.io/crates/d/clap.svg)](https://crates.io/crates/clap) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kbknapp/clap-rs/blob/master/LICENSE-MIT) [![Coverage Status](https://coveralls.io/repos/kbknapp/clap-rs/badge.svg?branch=master&service=github)](https://coveralls.io/github/kbknapp/clap-rs?branch=master) [![Join the chat at https://gitter.im/kbknapp/clap-rs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kbknapp/clap-rs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Crates.io](https://img.shields.io/crates/v/clap.svg)](https://crates.io/crates/clap) [![Crates.io](https://img.shields.io/crates/d/clap.svg)](https://crates.io/crates/clap) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/clap-rs/clap/blob/master/LICENSE-MIT) [![Coverage Status](https://coveralls.io/repos/kbknapp/clap-rs/badge.svg?branch=master&service=github)](https://coveralls.io/github/kbknapp/clap-rs?branch=master) [![Join the chat at https://gitter.im/kbknapp/clap-rs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kbknapp/clap-rs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 
 Linux: [![Build Status](https://travis-ci.org/clap-rs/clap.svg?branch=master)](https://travis-ci.org/clap-rs/clap)
 Windows: [![Build status](https://ci.appveyor.com/api/projects/status/ejg8c33dn31nhv36/branch/master?svg=true)](https://ci.appveyor.com/project/kbknapp/clap-rs/branch/master)
@@ -45,12 +45,12 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
 Here's whats new in 2.32.0:
 
 * `clap` requires `rustc 1.30.0` or greater.
-* **Completions:**  adds completion support for Elvish. ([e9d0562a](https://github.com/kbknapp/clap-rs/commit/e9d0562a1dc5dfe731ed7c767e6cee0af08f0cf9))
-* **ArgGroup and macros:**  Support shorthand syntax for ArgGroups ([df9095e7](https://github.com/kbknapp/clap-rs/commit/df9095e75bb1e7896415251d0d4ffd8a0ebcd559))
-* **OsValues:**  Add `ExactSizeIterator` implementation ([356c69e5](https://github.com/kbknapp/clap-rs/commit/356c69e508fd25a9f0ea2d27bf80ae1d9a8d88f4))
-* **arg_enum!:**  Invalid expansions of some trailing-comma patterns ([7023184f](https://github.com/kbknapp/clap-rs/commit/7023184fca04e852c270341548d6a16207d13862))
-* **help messages:**  Unconditionally uses long description for subcommands ([6acc8b6a](https://github.com/kbknapp/clap-rs/commit/6acc8b6a621a765cbf513450188000d943676a30), closes [#897](https://github.com/kbknapp/clap-rs/issues/897))
-* **Docs:** Refer to macOS rather than OSX. ([ab0d767f](https://github.com/kbknapp/clap-rs/commit/ab0d767f3a5a57e2bbb97d0183c2ef63c8c77a6c))
+* **Completions:**  adds completion support for Elvish. ([e9d0562a](https://github.com/clap-rs/clap/commit/e9d0562a1dc5dfe731ed7c767e6cee0af08f0cf9))
+* **ArgGroup and macros:**  Support shorthand syntax for ArgGroups ([df9095e7](https://github.com/clap-rs/clap/commit/df9095e75bb1e7896415251d0d4ffd8a0ebcd559))
+* **OsValues:**  Add `ExactSizeIterator` implementation ([356c69e5](https://github.com/clap-rs/clap/commit/356c69e508fd25a9f0ea2d27bf80ae1d9a8d88f4))
+* **arg_enum!:**  Invalid expansions of some trailing-comma patterns ([7023184f](https://github.com/clap-rs/clap/commit/7023184fca04e852c270341548d6a16207d13862))
+* **help messages:**  Unconditionally uses long description for subcommands ([6acc8b6a](https://github.com/clap-rs/clap/commit/6acc8b6a621a765cbf513450188000d943676a30), closes [#897](https://github.com/kbknapp/clap-rs/issues/897))
+* **Docs:** Refer to macOS rather than OSX. ([ab0d767f](https://github.com/clap-rs/clap/commit/ab0d767f3a5a57e2bbb97d0183c2ef63c8c77a6c))
 
 Here's whats new in 2.31.x:
 
@@ -70,7 +70,7 @@ Here's whats new in 2.31.x:
 * Use `codegen-units = 1` in release and bench profiles to improve bench performance
 * Fix some typos and markdown issues in the docs
 
-For full details, see [CHANGELOG.md](https://github.com/kbknapp/clap-rs/blob/master/CHANGELOG.md)
+For full details, see [CHANGELOG.md](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
 
 ## About
 
@@ -82,7 +82,7 @@ Once `clap` parses the user provided string of arguments, it returns the matches
 
 ## FAQ
 
-For a full FAQ and more in depth details, see [the wiki page](https://github.com/kbknapp/clap-rs/wiki/FAQ)
+For a full FAQ and more in depth details, see [the wiki page](https://github.com/clap-rs/clap/wiki/FAQ)
 
 ### Comparisons
 
@@ -343,7 +343,7 @@ Examples of each method can be found in the [examples/](examples) directory of t
 
 To try out the pre-built examples, use the following steps:
 
-* Clone the repository `$ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/`
+* Clone the repository `$ git clone https://github.com/clap-rs/clap && cd clap-rs/`
 * Compile the example `$ cargo build --example <EXAMPLE>`
 * Run the help info `$ ./target/debug/examples/<EXAMPLE> --help`
 * Play with the arguments!
diff --git a/index.html b/index.html
deleted file mode 100644
index 600dff93..00000000
--- a/index.html
+++ /dev/null
@@ -1,1 +0,0 @@
-<meta http-equiv="refresh" content="0; url=http://kbknapp.github.io/clap-rs/docs/clap/index.html" />
diff --git a/justfile b/justfile
index e9385c6b..0768764b 100644
--- a/justfile
+++ b/justfile
@@ -5,7 +5,7 @@
 	echo "the following is a list of contributors:" > CONTRIBUTORS.md
 	echo "" >> CONTRIBUTORS.md
 	echo "" >> CONTRIBUTORS.md
-	githubcontrib --owner kbknapp --repo clap-rs --sha master --cols 6 --format md --showlogin true --sortBy contributions --sortOrder desc >> CONTRIBUTORS.md
+	githubcontrib --owner clap-rs --repo clap --sha master --cols 6 --format md --showlogin true --sortBy contributions --sortOrder desc >> CONTRIBUTORS.md
 	echo "" >> CONTRIBUTORS.md
 	echo "" >> CONTRIBUTORS.md
 	echo "This list was generated by [mgechev/github-contributors-list](https://github.com/mgechev/github-contributors-list)" >> CONTRIBUTORS.md
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 9e46d387..b4187caa 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -149,8 +149,8 @@ impl<'a, 'b> App<'a, 'b> {
     /// # }
     /// ```
     /// [`App`]: ./struct.App.html
-    /// [`examples/17_yaml.rs`]: https://github.com/kbknapp/clap-rs/blob/master/examples/17_yaml.rs
-    /// [`examples/17_yaml.yml`]: https://github.com/kbknapp/clap-rs/blob/master/examples/17_yaml.yml
+    /// [`examples/17_yaml.rs`]: https://github.com/clap-rs/clap/blob/master/examples/17_yaml.rs
+    /// [`examples/17_yaml.yml`]: https://github.com/clap-rs/clap/blob/master/examples/17_yaml.yml
     /// [`panic!`]: https://doc.rust-lang.org/std/macro.panic!.html
     #[cfg(feature = "yaml")]
     pub fn from_yaml(yaml: &'a Yaml) -> App<'a, 'a> { App::from(yaml) }
@@ -174,7 +174,7 @@ impl<'a, 'b> App<'a, 'b> {
     /// # ;
     /// ```
     /// [`crate_authors!`]: ./macro.crate_authors!.html
-    /// [`examples/`]: https://github.com/kbknapp/clap-rs/tree/master/examples
+    /// [`examples/`]: https://github.com/clap-rs/clap/tree/master/examples
     pub fn author<S: Into<&'b str>>(mut self, author: S) -> Self {
         self.p.meta.author = Some(author.into());
         self
@@ -332,7 +332,7 @@ impl<'a, 'b> App<'a, 'b> {
     /// # ;
     /// ```
     /// [`crate_version!`]: ./macro.crate_version!.html
-    /// [`examples/`]: https://github.com/kbknapp/clap-rs/tree/master/examples
+    /// [`examples/`]: https://github.com/clap-rs/clap/tree/master/examples
     /// [`App::long_version`]: ./struct.App.html#method.long_version
     pub fn version<S: Into<&'b str>>(mut self, ver: S) -> Self {
         self.p.meta.version = Some(ver.into());
@@ -363,7 +363,7 @@ impl<'a, 'b> App<'a, 'b> {
     /// # ;
     /// ```
     /// [`crate_version!`]: ./macro.crate_version!.html
-    /// [`examples/`]: https://github.com/kbknapp/clap-rs/tree/master/examples
+    /// [`examples/`]: https://github.com/clap-rs/clap/tree/master/examples
     /// [`App::version`]: ./struct.App.html#method.version
     pub fn long_version<S: Into<&'b str>>(mut self, ver: S) -> Self {
         self.p.meta.long_version = Some(ver.into());
@@ -1215,7 +1215,7 @@ impl<'a, 'b> App<'a, 'b> {
     /// [`--help` (long)]: ./struct.Arg.html#method.long_help
     pub fn write_help<W: Write>(&self, w: &mut W) -> ClapResult<()> {
         // PENDING ISSUE: 808
-        //      https://github.com/kbknapp/clap-rs/issues/808
+        //      https://github.com/clap-rs/clap/issues/808
         // If there are global arguments, or settings we need to propagate them down to subcommands
         // before parsing incase we run into a subcommand
         // self.p.propagate_globals();
diff --git a/src/app/parser.rs b/src/app/parser.rs
index cb367cf6..36ff48f7 100644
--- a/src/app/parser.rs
+++ b/src/app/parser.rs
@@ -407,8 +407,8 @@ where
                     sc.p.set(AS::GlobalVersion);
                     sc.p.meta.version = Some(self.meta.version.unwrap());
                 }
-                sc.p.settings = sc.p.settings | self.g_settings;
-                sc.p.g_settings = sc.p.g_settings | self.g_settings;
+                sc.p.settings.update(&self.g_settings);
+                sc.p.g_settings.update(&self.g_settings);
                 sc.p.meta.term_w = self.meta.term_w;
                 sc.p.meta.max_w = self.meta.max_w;
             }
@@ -767,7 +767,7 @@ where
             pb.b.help = Some("The subcommand whose help message to display");
             pb.set(ArgSettings::Multiple);
             sc.positionals.insert(1, pb);
-            sc.settings = sc.settings | self.g_settings;
+            sc.settings.update(&self.g_settings);
         } else {
             sc.create_help_and_version();
         }
diff --git a/src/app/settings.rs b/src/app/settings.rs
index 4e7c6b5b..ac52f7d2 100644
--- a/src/app/settings.rs
+++ b/src/app/settings.rs
@@ -1,120 +1,122 @@
 // Std
+use std::collections::HashSet;
 #[allow(deprecated, unused_imports)]
 use std::ascii::AsciiExt;
 use std::str::FromStr;
-use std::ops::BitOr;
 
-bitflags! {
-    struct Flags: u64 {
-        const SC_NEGATE_REQS       = 1;
-        const SC_REQUIRED          = 1 << 1;
-        const A_REQUIRED_ELSE_HELP = 1 << 2;
-        const GLOBAL_VERSION       = 1 << 3;
-        const VERSIONLESS_SC       = 1 << 4;
-        const UNIFIED_HELP         = 1 << 5;
-        const WAIT_ON_ERROR        = 1 << 6;
-        const SC_REQUIRED_ELSE_HELP= 1 << 7;
-        const NEEDS_LONG_HELP      = 1 << 8;
-        const NEEDS_LONG_VERSION   = 1 << 9;
-        const NEEDS_SC_HELP        = 1 << 10;
-        const DISABLE_VERSION      = 1 << 11;
-        const HIDDEN               = 1 << 12;
-        const TRAILING_VARARG      = 1 << 13;
-        const NO_BIN_NAME          = 1 << 14;
-        const ALLOW_UNK_SC         = 1 << 15;
-        const UTF8_STRICT          = 1 << 16;
-        const UTF8_NONE            = 1 << 17;
-        const LEADING_HYPHEN       = 1 << 18;
-        const NO_POS_VALUES        = 1 << 19;
-        const NEXT_LINE_HELP       = 1 << 20;
-        const DERIVE_DISP_ORDER    = 1 << 21;
-        const COLORED_HELP         = 1 << 22;
-        const COLOR_ALWAYS         = 1 << 23;
-        const COLOR_AUTO           = 1 << 24;
-        const COLOR_NEVER          = 1 << 25;
-        const DONT_DELIM_TRAIL     = 1 << 26;
-        const ALLOW_NEG_NUMS       = 1 << 27;
-        const LOW_INDEX_MUL_POS    = 1 << 28;
-        const DISABLE_HELP_SC      = 1 << 29;
-        const DONT_COLLAPSE_ARGS   = 1 << 30;
-        const ARGS_NEGATE_SCS      = 1 << 31;
-        const PROPAGATE_VALS_DOWN  = 1 << 32;
-        const ALLOW_MISSING_POS    = 1 << 33;
-        const TRAILING_VALUES      = 1 << 34;
-        const VALID_NEG_NUM_FOUND  = 1 << 35;
-        const PROPAGATED           = 1 << 36;
-        const VALID_ARG_FOUND      = 1 << 37;
-        const INFER_SUBCOMMANDS    = 1 << 38;
-        const CONTAINS_LAST        = 1 << 39;
-        const ARGS_OVERRIDE_SELF   = 1 << 40;
-    }
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+enum Flags {
+    ScNegateReqs,
+    ScRequired,
+    ARequiredElseHelp,
+    GlobalVersion,
+    VersionlessSc,
+    UnifiedHelp,
+    WaitOnError,
+    ScRequiredElseHelp,
+    NeedsLongHelp,
+    NeedsLongVersion,
+    NeedsScHelp,
+    DisableVersion,
+    Hidden,
+    TrailingVararg,
+    NoBinName,
+    AllowUnkSc,
+    Utf8Strict,
+    Utf8None,
+    LeadingHyphen,
+    NoPosValues,
+    NextLineHelp,
+    DeriveDispOrder,
+    ColoredHelp,
+    ColorAlways,
+    ColorAuto,
+    ColorNever,
+    DontDelimTrail,
+    AllowNegNums,
+    LowIndexMulPos,
+    DisableHelpSc,
+    DontCollapseArgs,
+    ArgsNegateScs,
+    PropagateValsDown,
+    AllowMissingPos,
+    TrailingValues,
+    ValidNegNumFound,
+    Propagated,
+    ValidArgFound,
+    InferSubcommands,
+    ContainsLast,
+    ArgsOverrideSelf,
 }
 
 #[doc(hidden)]
-#[derive(Debug, Copy, Clone, PartialEq)]
-pub struct AppFlags(Flags);
-
-impl BitOr for AppFlags {
-    type Output = Self;
-    fn bitor(self, rhs: Self) -> Self { AppFlags(self.0 | rhs.0) }
-}
+#[derive(Debug, Clone, PartialEq)]
+pub struct AppFlags(HashSet<Flags>);
 
 impl Default for AppFlags {
     fn default() -> Self {
-        AppFlags(
-            Flags::NEEDS_LONG_VERSION | Flags::NEEDS_LONG_HELP | Flags::NEEDS_SC_HELP
-                | Flags::UTF8_NONE | Flags::COLOR_AUTO,
-        )
+        let mut set = HashSet::new();
+        set.insert(Flags::NeedsLongVersion);
+        set.insert(Flags::NeedsLongHelp);
+        set.insert(Flags::NeedsScHelp);
+        set.insert(Flags::Utf8None);
+        set.insert(Flags::ColorAuto);
+        AppFlags(set)
     }
 }
 
 #[allow(deprecated)]
 impl AppFlags {
     pub fn new() -> Self { AppFlags::default() }
-    pub fn zeroed() -> Self { AppFlags(Flags::empty()) }
+    pub fn zeroed() -> Self { AppFlags(HashSet::new()) }
+    pub fn update(&mut self, other: &Self) {
+        for flag in other.0.iter() {
+            self.0.insert(*flag);
+        }
+    }
 
     impl_settings! { AppSettings,
-        ArgRequiredElseHelp => Flags::A_REQUIRED_ELSE_HELP,
-        ArgsNegateSubcommands => Flags::ARGS_NEGATE_SCS,
-        AllArgsOverrideSelf => Flags::ARGS_OVERRIDE_SELF,
-        AllowExternalSubcommands => Flags::ALLOW_UNK_SC,
-        AllowInvalidUtf8 => Flags::UTF8_NONE,
-        AllowLeadingHyphen => Flags::LEADING_HYPHEN,
-        AllowNegativeNumbers => Flags::ALLOW_NEG_NUMS,
-        AllowMissingPositional => Flags::ALLOW_MISSING_POS,
-        ColoredHelp => Flags::COLORED_HELP,
-        ColorAlways => Flags::COLOR_ALWAYS,
-        ColorAuto => Flags::COLOR_AUTO,
-        ColorNever => Flags::COLOR_NEVER,
-        DontDelimitTrailingValues => Flags::DONT_DELIM_TRAIL,
-        DontCollapseArgsInUsage => Flags::DONT_COLLAPSE_ARGS,
-        DeriveDisplayOrder => Flags::DERIVE_DISP_ORDER,
-        DisableHelpSubcommand => Flags::DISABLE_HELP_SC,
-        DisableVersion => Flags::DISABLE_VERSION,
-        GlobalVersion => Flags::GLOBAL_VERSION,
-        HidePossibleValuesInHelp => Flags::NO_POS_VALUES,
-        Hidden => Flags::HIDDEN,
-        LowIndexMultiplePositional => Flags::LOW_INDEX_MUL_POS,
-        NeedsLongHelp => Flags::NEEDS_LONG_HELP,
-        NeedsLongVersion => Flags::NEEDS_LONG_VERSION,
-        NeedsSubcommandHelp => Flags::NEEDS_SC_HELP,
-        NoBinaryName => Flags::NO_BIN_NAME,
-        PropagateGlobalValuesDown=> Flags::PROPAGATE_VALS_DOWN,
-        StrictUtf8 => Flags::UTF8_STRICT,
-        SubcommandsNegateReqs => Flags::SC_NEGATE_REQS,
-        SubcommandRequired => Flags::SC_REQUIRED,
-        SubcommandRequiredElseHelp => Flags::SC_REQUIRED_ELSE_HELP,
-        TrailingVarArg => Flags::TRAILING_VARARG,
-        UnifiedHelpMessage => Flags::UNIFIED_HELP,
-        NextLineHelp => Flags::NEXT_LINE_HELP,
-        VersionlessSubcommands => Flags::VERSIONLESS_SC,
-        WaitOnError => Flags::WAIT_ON_ERROR,
-        TrailingValues => Flags::TRAILING_VALUES,
-        ValidNegNumFound => Flags::VALID_NEG_NUM_FOUND,
-        Propagated => Flags::PROPAGATED,
-        ValidArgFound => Flags::VALID_ARG_FOUND,
-        InferSubcommands => Flags::INFER_SUBCOMMANDS,
-        ContainsLast => Flags::CONTAINS_LAST
+        ArgRequiredElseHelp => Flags::ARequiredElseHelp,
+        ArgsNegateSubcommands => Flags::ArgsNegateScs,
+        AllArgsOverrideSelf => Flags::ArgsOverrideSelf,
+        AllowExternalSubcommands => Flags::AllowUnkSc,
+        AllowInvalidUtf8 => Flags::Utf8None,
+        AllowLeadingHyphen => Flags::LeadingHyphen,
+        AllowNegativeNumbers => Flags::AllowNegNums,
+        AllowMissingPositional => Flags::AllowMissingPos,
+        ColoredHelp => Flags::ColoredHelp,
+        ColorAlways => Flags::ColorAlways,
+        ColorAuto => Flags::ColorAuto,
+        ColorNever => Flags::ColorNever,
+        DontDelimitTrailingValues => Flags::DontDelimTrail,
+        DontCollapseArgsInUsage => Flags::DontCollapseArgs,
+        DeriveDisplayOrder => Flags::DeriveDispOrder,
+        DisableHelpSubcommand => Flags::DisableHelpSc,
+        DisableVersion => Flags::DisableVersion,
+        GlobalVersion => Flags::GlobalVersion,
+        HidePossibleValuesInHelp => Flags::NoPosValues,
+        Hidden => Flags::Hidden,
+        LowIndexMultiplePositional => Flags::LowIndexMulPos,
+        NeedsLongHelp => Flags::NeedsLongHelp,
+        NeedsLongVersion => Flags::NeedsLongVersion,
+        NeedsSubcommandHelp => Flags::NeedsScHelp,
+        NoBinaryName => Flags::NoBinName,
+        PropagateGlobalValuesDown=> Flags::PropagateValsDown,
+        StrictUtf8 => Flags::Utf8Strict,
+        SubcommandsNegateReqs => Flags::ScNegateReqs,
+        SubcommandRequired => Flags::ScRequired,
+        SubcommandRequiredElseHelp => Flags::ScRequiredElseHelp,
+        TrailingVarArg => Flags::TrailingVararg,
+        UnifiedHelpMessage => Flags::UnifiedHelp,
+        NextLineHelp => Flags::NextLineHelp,
+        VersionlessSubcommands => Flags::VersionlessSc,
+        WaitOnError => Flags::WaitOnError,
+        TrailingValues => Flags::TrailingValues,
+        ValidNegNumFound => Flags::ValidNegNumFound,
+        Propagated => Flags::Propagated,
+        ValidArgFound => Flags::ValidArgFound,
+        InferSubcommands => Flags::InferSubcommands,
+        ContainsLast => Flags::ContainsLast
     }
 }
 
diff --git a/src/app/validator.rs b/src/app/validator.rs
index fce4cf29..181b831d 100644
--- a/src/app/validator.rs
+++ b/src/app/validator.rs
@@ -401,8 +401,8 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> {
         } else {
             false
         };
-        // Issue 665 (https://github.com/kbknapp/clap-rs/issues/665)
-        // Issue 1105 (https://github.com/kbknapp/clap-rs/issues/1105)
+        // Issue 665 (https://github.com/clap-rs/clap/issues/665)
+        // Issue 1105 (https://github.com/clap-rs/clap/issues/1105)
         if a.takes_value() && !min_vals_zero && ma.vals.is_empty() {
             return Err(Error::empty_value(
                 a,
diff --git a/src/args/arg.rs b/src/args/arg.rs
index 845b4b21..50a30abb 100644
--- a/src/args/arg.rs
+++ b/src/args/arg.rs
@@ -1,5 +1,5 @@
 #[cfg(feature = "yaml")]
-use linked_hash_map::LinkedHashMap;
+use std::collections::BTreeMap;
 use std::rc::Rc;
 use std::ffi::{OsStr, OsString};
 #[cfg(any(target_os = "windows", target_arch = "wasm32"))]
@@ -91,7 +91,7 @@ impl<'a, 'b> Arg<'a, 'b> {
     /// ```
     /// [`Arg`]: ./struct.Arg.html
     #[cfg(feature = "yaml")]
-    pub fn from_yaml(y: &LinkedHashMap<Yaml, Yaml>) -> Arg {
+    pub fn from_yaml(y: &BTreeMap<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();
diff --git a/src/args/group.rs b/src/args/group.rs
index 26164c2d..f8bfb7a0 100644
--- a/src/args/group.rs
+++ b/src/args/group.rs
@@ -1,5 +1,5 @@
 #[cfg(feature = "yaml")]
-use linked_hash_map::LinkedHashMap;
+use std::collections::BTreeMap;
 use std::fmt::{Debug, Formatter, Result};
 
 #[cfg(feature = "yaml")]
@@ -454,8 +454,8 @@ impl<'a, 'z> From<&'z ArgGroup<'a>> for ArgGroup<'a> {
 }
 
 #[cfg(feature = "yaml")]
-impl<'a> From<&'a LinkedHashMap<Yaml, Yaml>> for ArgGroup<'a> {
-    fn from(b: &'a LinkedHashMap<Yaml, Yaml>) -> Self {
+impl<'a> From<&'a BTreeMap<Yaml, Yaml>> for ArgGroup<'a> {
+    fn from(b: &'a BTreeMap<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 {
diff --git a/src/args/settings.rs b/src/args/settings.rs
index 7b0e0a26..436fe664 100644
--- a/src/args/settings.rs
+++ b/src/args/settings.rs
@@ -1,66 +1,71 @@
 // Std
+use std::collections::HashSet;
 #[allow(deprecated, unused_imports)]
 use std::ascii::AsciiExt;
 use std::str::FromStr;
 
-bitflags! {
-    struct Flags: u32 {
-        const REQUIRED         = 1;
-        const MULTIPLE         = 1 << 1;
-        const EMPTY_VALS       = 1 << 2;
-        const GLOBAL           = 1 << 3;
-        const HIDDEN           = 1 << 4;
-        const TAKES_VAL        = 1 << 5;
-        const USE_DELIM        = 1 << 6;
-        const NEXT_LINE_HELP   = 1 << 7;
-        const R_UNLESS_ALL     = 1 << 8;
-        const REQ_DELIM        = 1 << 9;
-        const DELIM_NOT_SET    = 1 << 10;
-        const HIDE_POS_VALS    = 1 << 11;
-        const ALLOW_TAC_VALS   = 1 << 12;
-        const REQUIRE_EQUALS   = 1 << 13;
-        const LAST             = 1 << 14;
-        const HIDE_DEFAULT_VAL = 1 << 15;
-        const CASE_INSENSITIVE = 1 << 16;
-        const HIDE_ENV_VALS    = 1 << 17;
-        const HIDDEN_SHORT_H   = 1 << 18;
-        const HIDDEN_LONG_H    = 1 << 19;
-    }
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+enum Flags {
+    Required,
+    Multiple,
+    EmptyVals,
+    Global,
+    Hidden,
+    TakesVal,
+    UseDelim,
+    NextLineHelp,
+    RUnlessAll,
+    ReqDelim,
+    DelimNotSet,
+    HidePosVals,
+    AllowTacVals,
+    RequireEquals,
+    Last,
+    HideDefaultVal,
+    CaseInsensitive,
+    HideEnvVals,
+    HiddenShortH,
+    HiddenLongH
 }
 
 #[doc(hidden)]
-#[derive(Debug, Clone, Copy)]
-pub struct ArgFlags(Flags);
+#[derive(Debug, Clone)]
+pub struct ArgFlags(HashSet<Flags>);
 
 impl ArgFlags {
     pub fn new() -> Self { ArgFlags::default() }
 
     impl_settings!{ArgSettings,
-        Required => Flags::REQUIRED,
-        Multiple => Flags::MULTIPLE,
-        EmptyValues => Flags::EMPTY_VALS,
-        Global => Flags::GLOBAL,
-        Hidden => Flags::HIDDEN,
-        TakesValue => Flags::TAKES_VAL,
-        UseValueDelimiter => Flags::USE_DELIM,
-        NextLineHelp => Flags::NEXT_LINE_HELP,
-        RequiredUnlessAll => Flags::R_UNLESS_ALL,
-        RequireDelimiter => Flags::REQ_DELIM,
-        ValueDelimiterNotSet => Flags::DELIM_NOT_SET,
-        HidePossibleValues => Flags::HIDE_POS_VALS,
-        AllowLeadingHyphen => Flags::ALLOW_TAC_VALS,
-        RequireEquals => Flags::REQUIRE_EQUALS,
-        Last => Flags::LAST,
-        CaseInsensitive => Flags::CASE_INSENSITIVE,
-        HideEnvValues => Flags::HIDE_ENV_VALS,
-        HideDefaultValue => Flags::HIDE_DEFAULT_VAL,
-        HiddenShortHelp => Flags::HIDDEN_SHORT_H,
-        HiddenLongHelp => Flags::HIDDEN_LONG_H
+        Required => Flags::Required,
+        Multiple => Flags::Multiple,
+        EmptyValues => Flags::EmptyVals,
+        Global => Flags::Global,
+        Hidden => Flags::Hidden,
+        TakesValue => Flags::TakesVal,
+        UseValueDelimiter => Flags::UseDelim,
+        NextLineHelp => Flags::NextLineHelp,
+        RequiredUnlessAll => Flags::RUnlessAll,
+        RequireDelimiter => Flags::ReqDelim,
+        ValueDelimiterNotSet => Flags::DelimNotSet,
+        HidePossibleValues => Flags::HidePosVals,
+        AllowLeadingHyphen => Flags::AllowTacVals,
+        RequireEquals => Flags::RequireEquals,
+        Last => Flags::Last,
+        CaseInsensitive => Flags::CaseInsensitive,
+        HideEnvValues => Flags::HideEnvVals,
+        HideDefaultValue => Flags::HideDefaultVal,
+        HiddenShortHelp => Flags::HiddenShortH,
+        HiddenLongHelp => Flags::HiddenLongH
     }
 }
 
 impl Default for ArgFlags {
-    fn default() -> Self { ArgFlags(Flags::EMPTY_VALS | Flags::DELIM_NOT_SET) }
+    fn default() -> Self {
+        let mut set = HashSet::new();
+        set.insert(Flags::EmptyVals);
+        set.insert(Flags::DelimNotSet);
+        ArgFlags(set)
+    }
 }
 
 /// Various settings that apply to arguments and may be set, unset, and checked via getter/setter
diff --git a/src/lib.rs b/src/lib.rs
index 87abc737..27a9f7cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,4 @@
-// Copyright ⓒ 2015-2016 Kevin B. Knapp and [`clap-rs` contributors](https://github.com/kbknapp/clap-rs/blob/master/CONTRIBUTORS.md).
+// Copyright ⓒ 2015-2016 Kevin B. Knapp and [`clap-rs` contributors](https://github.com/clap-rs/clap/blob/master/CONTRIBUTORS.md).
 // Licensed under the MIT license
 // (see LICENSE or <http://opensource.org/licenses/MIT>) All files in the project carrying such
 // notice may not be copied, modified, or distributed except according to those terms.
@@ -266,7 +266,7 @@
 //!
 //! To try out the pre-built example, use the following steps:
 //!
-//! * Clone the repository `$ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/tests`
+//! * Clone the repository `$ git clone https://github.com/clap-rs/clap && cd clap-rs/tests`
 //! * Compile the example `$ cargo build --release`
 //! * Run the help info `$ ./target/release/claptests --help`
 //! * Play with the arguments!
@@ -313,7 +313,7 @@
 //!
 //! ```toml
 //! [dependencies.clap]
-//! git = "https://github.com/kbknapp/clap-rs.git"
+//! git = "https://github.com/clap-rs/clap.git"
 //! ```
 //!
 //! Add `extern crate clap;` to your crate root.
@@ -366,7 +366,7 @@
 //!  * **Red** Color: **NOT** included by default (must use cargo `features` to enable)
 //!  * **Blue** Color: Dev dependency, only used while developing.
 //!
-//! ![clap dependencies](https://raw.githubusercontent.com/kbknapp/clap-rs/master/clap_dep_graph.png)
+//! ![clap dependencies](https://raw.githubusercontent.com/clap-rs/clap/master/clap_dep_graph.png)
 //!
 //! ### More Information
 //!
@@ -391,7 +391,7 @@
 //! `clap`. You can either add it to the [examples/] directory, or file an issue and tell
 //! me. I'm all about giving credit where credit is due :)
 //!
-//! Please read [CONTRIBUTING.md](https://raw.githubusercontent.com/kbknapp/clap-rs/master/.github/CONTRIBUTING.md) before you start contributing.
+//! Please read [CONTRIBUTING.md](https://raw.githubusercontent.com/clap-rs/clap/master/.github/CONTRIBUTING.md) before you start contributing.
 //!
 //!
 //! ### Testing Code
@@ -512,17 +512,16 @@
 //! `clap` is licensed under the MIT license. Please read the [LICENSE-MIT][license] file in
 //! this repository for more information.
 //!
-//! [examples/]: https://github.com/kbknapp/clap-rs/tree/master/examples
+//! [examples/]: https://github.com/clap-rs/clap/tree/master/examples
 //! [video tutorials]: https://www.youtube.com/playlist?list=PLza5oFLQGTl2Z5T8g1pRkIynR3E0_pc7U
-//! [license]: https://raw.githubusercontent.com/kbknapp/clap-rs/master/LICENSE-MIT
+//! [license]: https://raw.githubusercontent.com/clap-rs/clap/master/LICENSE-MIT
 
 #![crate_type = "lib"]
 #![doc(html_root_url = "https://docs.rs/clap/2.32.0")]
 #![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts,
-        unused_import_braces, unused_allocation)]
+        unused_import_braces, unused_allocation, trivial_numeric_casts)]
 // Lints we'd like to deny but are currently failing for upstream crates
-//      unused_qualifications       (bitflags, clippy)
-//      trivial_numeric_casts       (bitflags)
+//      unused_qualifications       (clippy)
 #![cfg_attr(not(any(feature = "lints", feature = "nightly")), forbid(unstable_features))]
 #![cfg_attr(feature = "lints", feature(plugin))]
 #![cfg_attr(feature = "lints", plugin(clippy))]
@@ -536,8 +535,6 @@
 extern crate ansi_term;
 #[cfg(feature = "color")]
 extern crate atty;
-#[macro_use]
-extern crate bitflags;
 #[cfg(feature = "suggestions")]
 extern crate strsim;
 #[cfg(feature = "wrap_help")]
@@ -548,8 +545,6 @@ 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;
@@ -573,7 +568,7 @@ mod completions;
 mod map;
 
 const INTERNAL_ERROR_MSG: &'static str = "Fatal internal error. Please consider filing a bug \
-                                          report at https://github.com/kbknapp/clap-rs/issues";
+                                          report at https://github.com/clap-rs/clap/issues";
 const INVALID_UTF8: &'static str = "unexpected invalid UTF-8 code point";
 
 #[cfg(unstable)]
diff --git a/src/macros.rs b/src/macros.rs
index 74212ff0..b935be36 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -800,18 +800,18 @@ macro_rules! impl_settings {
         pub fn set(&mut self, s: $n) {
             match s {
                 $($n::$v => self.0.insert($c)),+
-            }
+            };
         }
 
         pub fn unset(&mut self, s: $n) {
             match s {
-                $($n::$v => self.0.remove($c)),+
-            }
+                $($n::$v => self.0.remove(&$c)),+
+            };
         }
 
         pub fn is_set(&self, s: $n) -> bool {
             match s {
-                $($n::$v => self.0.contains($c)),+
+                $($n::$v => self.0.contains(&$c)),+
             }
         }
     };


Test patch:
diff --git a/tests/default_vals.rs b/tests/default_vals.rs
index abcf0abe..0dfd3c86 100644
--- a/tests/default_vals.rs
+++ b/tests/default_vals.rs
@@ -495,4 +495,4 @@ fn issue_1050_num_vals_and_defaults() {
     assert!(res.is_ok());
     let m = res.unwrap();
     assert_eq!(m.value_of("exit-code"), Some("1"));
-}
\ No newline at end of file
+}
diff --git a/tests/hidden_args.rs b/tests/hidden_args.rs
index bf6a2234..635e25e2 100644
--- a/tests/hidden_args.rs
+++ b/tests/hidden_args.rs
@@ -175,4 +175,4 @@ fn hidden_long_args_short_help() {
                 .help("This text should be visible")]);
 
     assert!(test::compare_output(app, "test -h", HIDDEN_LONG_ARGS_SHORT_HELP, false));        
-}
\ No newline at end of file
+}
diff --git a/tests/indices.rs b/tests/indices.rs
index ebc7a529..910529ec 100644
--- a/tests/indices.rs
+++ b/tests/indices.rs
@@ -172,4 +172,4 @@ fn indices_mult_opt_mult_flag() {
 
     assert_eq!(m.indices_of("option").unwrap().collect::<Vec<_>>(), &[2, 5]);
     assert_eq!(m.indices_of("flag").unwrap().collect::<Vec<_>>(), &[3, 6]);
-}
\ No newline at end of file
+}
diff --git a/tests/multiple_values.rs b/tests/multiple_values.rs
index 7f35e06a..551aff1b 100644
--- a/tests/multiple_values.rs
+++ b/tests/multiple_values.rs
@@ -1119,4 +1119,4 @@ fn multiple_vals_with_hyphen() {
     let cmds: Vec<_> = m.values_of("cmds").unwrap().collect();
     assert_eq!(&cmds, &["find", "-type", "f", "-name", "special"]);
     assert_eq!(m.value_of("location"), Some("/home/clap"));
-}
\ No newline at end of file
+}
diff --git a/tests/require.rs b/tests/require.rs
index a0a658ea..7121aa5e 100644
--- a/tests/require.rs
+++ b/tests/require.rs
@@ -367,7 +367,7 @@ fn required_unless_one_2() {
 
 #[test]
 fn required_unless_one_works_with_short() {
-    // GitHub issue: https://github.com/kbknapp/clap-rs/issues/1135
+    // GitHub issue: https://github.com/clap-rs/clap/issues/1135
     let res = App::new("unlessone")
         .arg(Arg::with_name("a").conflicts_with("b").short("a"))
         .arg(Arg::with_name("b").short("b"))
@@ -685,4 +685,4 @@ fn require_eq() {
             .help("some")
         );
     assert!(test::compare_output(app, "clap-test", REQUIRE_EQUALS, true));
-}
\ No newline at end of file
+}
diff --git a/tests/version.rs b/tests/version.rs
index de0f8179..8bbd4745 100644
--- a/tests/version.rs
+++ b/tests/version.rs
@@ -55,4 +55,4 @@ fn override_ver() {
 
     assert!(m.is_ok());
     assert!(m.unwrap().is_present("version"));
-}
\ No newline at end of file
+}