mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #5206 from cakebaker/fix_bool_to_int_with_if
uucore,comm: fix warnings from bool_to_int_with_if
This commit is contained in:
commit
e8ed65f4fa
2 changed files with 4 additions and 12 deletions
|
@ -30,14 +30,6 @@ mod options {
|
||||||
pub const ZERO_TERMINATED: &str = "zero-terminated";
|
pub const ZERO_TERMINATED: &str = "zero-terminated";
|
||||||
}
|
}
|
||||||
|
|
||||||
fn column_width(col: &str, opts: &ArgMatches) -> usize {
|
|
||||||
if opts.get_flag(col) {
|
|
||||||
0
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Input {
|
enum Input {
|
||||||
Stdin(Stdin),
|
Stdin(Stdin),
|
||||||
FileIn(BufReader<File>),
|
FileIn(BufReader<File>),
|
||||||
|
@ -75,8 +67,8 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &ArgMatches) {
|
||||||
delim => delim,
|
delim => delim,
|
||||||
};
|
};
|
||||||
|
|
||||||
let width_col_1 = column_width(options::COLUMN_1, opts);
|
let width_col_1 = usize::from(!opts.get_flag(options::COLUMN_1));
|
||||||
let width_col_2 = column_width(options::COLUMN_2, opts);
|
let width_col_2 = usize::from(!opts.get_flag(options::COLUMN_2));
|
||||||
|
|
||||||
let delim_col_2 = delim.repeat(width_col_1);
|
let delim_col_2 = delim.repeat(width_col_1);
|
||||||
let delim_col_3 = delim.repeat(width_col_1 + width_col_2);
|
let delim_col_3 = delim.repeat(width_col_1 + width_col_2);
|
||||||
|
|
|
@ -130,8 +130,8 @@ pub fn set_utility_is_second_arg() {
|
||||||
static ARGV: Lazy<Vec<OsString>> = Lazy::new(|| wild::args_os().collect());
|
static ARGV: Lazy<Vec<OsString>> = Lazy::new(|| wild::args_os().collect());
|
||||||
|
|
||||||
static UTIL_NAME: Lazy<String> = Lazy::new(|| {
|
static UTIL_NAME: Lazy<String> = Lazy::new(|| {
|
||||||
let base_index = if get_utility_is_second_arg() { 1 } else { 0 };
|
let base_index = usize::from(get_utility_is_second_arg());
|
||||||
let is_man = if ARGV[base_index].eq("manpage") { 1 } else { 0 };
|
let is_man = usize::from(ARGV[base_index].eq("manpage"));
|
||||||
let argv_index = base_index + is_man;
|
let argv_index = base_index + is_man;
|
||||||
|
|
||||||
ARGV[argv_index].to_string_lossy().into_owned()
|
ARGV[argv_index].to_string_lossy().into_owned()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue