]>
git.proxmox.com Git - rustc.git/blob - vendor/clap/src/util/mod.rs
1 #![allow(clippy::single_component_path_imports)]
3 pub(crate) mod flat_map
;
4 pub(crate) mod flat_set
;
11 pub(crate) use self::flat_map
::Entry
;
12 pub(crate) use self::flat_map
::FlatMap
;
13 pub(crate) use self::flat_set
::FlatSet
;
14 pub(crate) use self::graph
::ChildGraph
;
15 pub(crate) use self::str_to_bool
::str_to_bool
;
16 pub(crate) use self::str_to_bool
::FALSE_LITERALS
;
17 pub(crate) use self::str_to_bool
::TRUE_LITERALS
;
21 pub(crate) const SUCCESS_CODE
: i32 = 0;
22 // While sysexists.h defines EX_USAGE as 64, this doesn't seem to be used much in practice but
23 // instead 2 seems to be frequently used.
25 // - GNU `ls` returns 2
26 // - Python's `argparse` returns 2
27 pub(crate) const USAGE_CODE
: i32 = 2;
29 pub(crate) fn safe_exit(code
: i32) -> ! {
32 let _
= std
::io
::stdout().lock().flush();
33 let _
= std
::io
::stderr().lock().flush();
35 std
::process
::exit(code
)
38 #[cfg(not(feature = "unicode"))]
39 pub(crate) fn eq_ignore_case(left
: &str, right
: &str) -> bool
{
40 left
.eq_ignore_ascii_case(right
)
43 #[cfg(feature = "unicode")]
44 pub(crate) use unicase
::eq
as eq_ignore_case
;