Skip to content

Commit 9abdb43

Browse files
committed
fix(clap): remove unstable features for Rust 1.0
1 parent 60e4072 commit 9abdb43

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/app.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
extern crate libc;
2-
31
use std::collections::BTreeMap;
42
use std::collections::HashMap;
53
use std::collections::HashSet;
64
use std::env;
75
use std::path::Path;
86
use std::vec::IntoIter;
97
use std::borrow::ToOwned;
8+
use std::process;
109

1110
use args::{ ArgMatches, Arg, SubCommand };
1211
use args::{FlagArg, FlagBuilder};
@@ -619,7 +618,7 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
619618
}
620619
}
621620

622-
self.exit();
621+
self.exit(0);
623622
}
624623

625624
#[inline(always)]
@@ -657,17 +656,18 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
657656
// Print the binary name if existing, but replace all spaces with hyphens in case we're
658657
// dealing with subcommands i.e. git mv is translated to git-mv
659658
println!("{} {}", &self.bin_name.clone().unwrap_or(self.name.clone())[..].replace(" ", "-"), self.version.unwrap_or("") );
660-
if quit { self.exit(); }
659+
if quit { self.exit(0); }
661660
}
662661

663-
fn exit(&self) {
664-
unsafe { libc::exit(0); }
662+
fn exit(&self, status: i32) {
663+
process::exit(status);
664+
// unsafe { libc::exit(0); }
665665
}
666666

667667
fn report_error(&self, msg: String, usage: bool, quit: bool) {
668668
println!("{}", msg);
669669
if usage { self.print_usage(true); }
670-
if quit { env::set_exit_status(1); self.exit(); }
670+
if quit { self.exit(1); }
671671
}
672672

673673
pub fn get_matches(mut self) -> ArgMatches<'ar> {

src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#![crate_type= "lib"]
22

3-
#![feature(exit_status)]
4-
53
// DOCS
64

7-
extern crate libc;
8-
95
pub use args::{Arg, SubCommand, ArgMatches};
106
pub use app::App;
117

0 commit comments

Comments
 (0)