From d0d9683df8398696147e7ee1fcffb2e4e957008c Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sat, 4 Apr 2020 14:39:19 -0700 Subject: Remove vendored dependencies While it appears that by now we actually can get successful builds without Cargo insisting on Internet access by virtue of using the --frozen flag, maintaining vendored dependencies is somewhat of a pain point. This state will also get worse with upcoming changes that replace argparse in favor of structopt and pull in a slew of new dependencies by doing so. Then there is also the repository structure aspect, which is non-standard due to the way we vendor dependencies and a potential source of confusion. In order to fix these problems, this change removes all the vendored dependencies we have. Delete subrepo argparse/:argparse Delete subrepo base32/:base32 Delete subrepo cc/:cc Delete subrepo cfg-if/:cfg-if Delete subrepo getrandom/:getrandom Delete subrepo lazy-static/:lazy-static Delete subrepo libc/:libc Delete subrepo nitrokey-sys/:nitrokey-sys Delete subrepo nitrokey/:nitrokey Delete subrepo rand/:rand --- argparse/src/generic.rs | 133 ------------------------------------------------ 1 file changed, 133 deletions(-) delete mode 100644 argparse/src/generic.rs (limited to 'argparse/src/generic.rs') diff --git a/argparse/src/generic.rs b/argparse/src/generic.rs deleted file mode 100644 index 1b1b7dc..0000000 --- a/argparse/src/generic.rs +++ /dev/null @@ -1,133 +0,0 @@ -use std::cell::RefCell; -use std::str::FromStr; -use std::rc::Rc; - -use super::{StoreConst, Store, StoreOption, List, Collect, PushConst}; -use super::action::Action; -use super::action::{TypedAction, IFlagAction, IArgAction, IArgsAction}; -use super::action::ParseResult; -use super::action::ParseResult::{Parsed, Error}; -use super::action::Action::{Flag, Single, Push, Many}; - -pub struct StoreConstAction<'a, T: 'a> { - pub value: T, - pub cell: Rc>, -} - -pub struct PushConstAction<'a, T: 'a> { - pub value: T, - pub cell: Rc>>, -} - -pub struct StoreAction<'a, T: 'a> { - pub cell: Rc>, -} - -pub struct StoreOptionAction<'a, T: 'a> { - cell: Rc>>, -} - -pub struct ListAction<'a, T: 'a> { - cell: Rc>>, -} - -impl TypedAction for StoreConst { - fn bind<'x>(&self, cell: Rc>) -> Action<'x> { - let StoreConst(ref val) = *self; - return Flag(Box::new(StoreConstAction { cell: cell, value: val.clone() })); - } -} - -impl TypedAction> for PushConst { - fn bind<'x>(&self, cell: Rc>>) -> Action<'x> { - let PushConst(ref val) = *self; - return Flag(Box::new(PushConstAction { cell: cell, value: val.clone() })); - } -} - -impl TypedAction for Store { - fn bind<'x>(&self, cell: Rc>) -> Action<'x> { - return Single(Box::new(StoreAction { cell: cell })); - } -} - -impl TypedAction> for StoreOption { - fn bind<'x>(&self, cell: Rc>>) -> Action<'x> { - return Single(Box::new(StoreOptionAction { cell: cell })); - } -} - -impl TypedAction> for List { - fn bind<'x>(&self, cell: Rc>>) -> Action<'x> { - return Many(Box::new(ListAction { cell: cell })); - } -} - -impl TypedAction> for Collect { - fn bind<'x>(&self, cell: Rc>>) -> Action<'x> { - return Push(Box::new(ListAction { cell: cell })); - } -} - -impl<'a, T: Clone> IFlagAction for StoreConstAction<'a, T> { - fn parse_flag(&self) -> ParseResult { - let mut targ = self.cell.borrow_mut(); - **targ = self.value.clone(); - return Parsed; - } -} - -impl<'a, T: Clone> IFlagAction for PushConstAction<'a, T> { - fn parse_flag(&self) -> ParseResult { - let mut targ = self.cell.borrow_mut(); - targ.push(self.value.clone()); - return Parsed; - } -} - -impl<'a, T: FromStr> IArgAction for StoreAction<'a, T> { - fn parse_arg(&self, arg: &str) -> ParseResult { - match FromStr::from_str(arg) { - Ok(x) => { - **self.cell.borrow_mut() = x; - return Parsed; - } - Err(_) => { - return Error(format!("Bad value {}", arg)); - } - } - } -} - -impl<'a, T: FromStr> IArgAction for StoreOptionAction<'a, T> { - fn parse_arg(&self, arg: &str) -> ParseResult { - match FromStr::from_str(arg) { - Ok(x) => { - **self.cell.borrow_mut() = Some(x); - return Parsed; - } - Err(_) => { - return Error(format!("Bad value {}", arg)); - } - } - } -} - -impl<'a, T: FromStr + Clone> IArgsAction for ListAction<'a, T> { - fn parse_args(&self, args: &[&str]) -> ParseResult { - let mut result = vec!(); - for arg in args.iter() { - match FromStr::from_str(*arg) { - Ok(x) => { - result.push(x); - } - Err(_) => { - return Error(format!("Bad value {}", arg)); - } - } - } - **self.cell.borrow_mut() = result; - return Parsed; - } -} - -- cgit v1.2.1