1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 19:36:16 +00:00

Removes or ignores all compiler warnings

This commit is contained in:
Tyler 2021-07-02 15:30:46 -07:00
parent 8e862b86dd
commit 860cbc6311
8 changed files with 57 additions and 40 deletions

View file

@ -68,18 +68,31 @@ pub struct OConvFlags {
/// Stores all Flags that apply to the input /// Stores all Flags that apply to the input
pub struct IFlags { pub struct IFlags {
#[allow(dead_code)]
pub cio: bool, pub cio: bool,
#[allow(dead_code)]
pub direct: bool, pub direct: bool,
#[allow(dead_code)]
pub directory: bool, pub directory: bool,
#[allow(dead_code)]
pub dsync: bool, pub dsync: bool,
#[allow(dead_code)]
pub sync: bool, pub sync: bool,
#[allow(dead_code)]
pub nocache: bool, pub nocache: bool,
#[allow(dead_code)]
pub nonblock: bool, pub nonblock: bool,
#[allow(dead_code)]
pub noatime: bool, pub noatime: bool,
#[allow(dead_code)]
pub noctty: bool, pub noctty: bool,
#[allow(dead_code)]
pub nofollow: bool, pub nofollow: bool,
#[allow(dead_code)]
pub nolinks: bool, pub nolinks: bool,
#[allow(dead_code)]
pub binary: bool, pub binary: bool,
#[allow(dead_code)]
pub text: bool, pub text: bool,
pub fullblock: bool, pub fullblock: bool,
pub count_bytes: bool, pub count_bytes: bool,
@ -89,18 +102,31 @@ pub struct IFlags {
/// Stores all Flags that apply to the output /// Stores all Flags that apply to the output
pub struct OFlags { pub struct OFlags {
pub append: bool, pub append: bool,
#[allow(dead_code)]
pub cio: bool, pub cio: bool,
#[allow(dead_code)]
pub direct: bool, pub direct: bool,
#[allow(dead_code)]
pub directory: bool, pub directory: bool,
#[allow(dead_code)]
pub dsync: bool, pub dsync: bool,
#[allow(dead_code)]
pub sync: bool, pub sync: bool,
#[allow(dead_code)]
pub nocache: bool, pub nocache: bool,
#[allow(dead_code)]
pub nonblock: bool, pub nonblock: bool,
#[allow(dead_code)]
pub noatime: bool, pub noatime: bool,
#[allow(dead_code)]
pub noctty: bool, pub noctty: bool,
#[allow(dead_code)]
pub nofollow: bool, pub nofollow: bool,
#[allow(dead_code)]
pub nolinks: bool, pub nolinks: bool,
#[allow(dead_code)]
pub binary: bool, pub binary: bool,
#[allow(dead_code)]
pub text: bool, pub text: bool,
pub seek_bytes: bool, pub seek_bytes: bool,
} }

View file

@ -42,7 +42,7 @@ use std::sync::{atomic::AtomicUsize, atomic::Ordering, mpsc, Arc};
use std::thread; use std::thread;
use std::time; use std::time;
const SYNTAX: &str = "dd [OPERAND]...\ndd OPTION"; // const SYNTAX: &str = "dd [OPERAND]...\ndd OPTION";
const ABOUT: &str = "copy, and optionally convert, a file system resource"; const ABOUT: &str = "copy, and optionally convert, a file system resource";
const BUF_INIT_BYTE: u8 = 0xDD; const BUF_INIT_BYTE: u8 = 0xDD;
const RTN_SUCCESS: i32 = 0; const RTN_SUCCESS: i32 = 0;
@ -294,14 +294,12 @@ struct Output<W: Write> {
dst: W, dst: W,
obs: usize, obs: usize,
cflags: OConvFlags, cflags: OConvFlags,
oflags: OFlags,
} }
impl Output<io::Stdout> { impl Output<io::Stdout> {
fn new(matches: &Matches) -> Result<Self, Box<dyn Error>> { fn new(matches: &Matches) -> Result<Self, Box<dyn Error>> {
let obs = parseargs::parse_obs(matches)?; let obs = parseargs::parse_obs(matches)?;
let cflags = parseargs::parse_conv_flag_output(matches)?; let cflags = parseargs::parse_conv_flag_output(matches)?;
let oflags = parseargs::parse_oflags(matches)?;
let dst = io::stdout(); let dst = io::stdout();
@ -309,7 +307,6 @@ impl Output<io::Stdout> {
dst, dst,
obs, obs,
cflags, cflags,
oflags,
}) })
} }
@ -396,7 +393,6 @@ impl Output<File> {
dst, dst,
obs, obs,
cflags, cflags,
oflags,
}) })
} else { } else {
// The following error should only occur if someone // The following error should only occur if someone

View file

@ -39,7 +39,6 @@ macro_rules! make_block_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: 512, obs: 512,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
$spec, $spec,
format!("./test-resources/FAILED-{}.test", $test_name) format!("./test-resources/FAILED-{}.test", $test_name)
@ -72,7 +71,6 @@ macro_rules! make_unblock_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: 512, obs: 512,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
$spec, $spec,
format!("./test-resources/FAILED-{}.test", $test_name) format!("./test-resources/FAILED-{}.test", $test_name)

View file

@ -25,7 +25,6 @@ macro_rules! make_sync_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: $obs, obs: $obs,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
$spec, $spec,
format!("./test-resources/FAILED-{}.test", $test_name) format!("./test-resources/FAILED-{}.test", $test_name)

View file

@ -18,7 +18,6 @@ macro_rules! make_conv_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: 512, obs: 512,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
$spec, $spec,
format!("./test-resources/FAILED-{}.test", $test_name) format!("./test-resources/FAILED-{}.test", $test_name)
@ -44,7 +43,6 @@ macro_rules! make_icf_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: 512, obs: 512,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
$spec, $spec,
format!("./test-resources/FAILED-{}.test", $test_name) format!("./test-resources/FAILED-{}.test", $test_name)
@ -151,7 +149,6 @@ fn all_valid_ascii_ebcdic_ascii_roundtrip_conv_test() {
dst: File::create(&tmp_fname_ae).unwrap(), dst: File::create(&tmp_fname_ae).unwrap(),
obs: 1024, obs: 1024,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}; };
dd_fileout(i, o).unwrap(); dd_fileout(i, o).unwrap();
@ -174,7 +171,6 @@ fn all_valid_ascii_ebcdic_ascii_roundtrip_conv_test() {
dst: File::create(&tmp_fname_ea).unwrap(), dst: File::create(&tmp_fname_ea).unwrap(),
obs: 1024, obs: 1024,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}; };
dd_fileout(i, o).unwrap(); dd_fileout(i, o).unwrap();

View file

@ -37,23 +37,23 @@ const DEFAULT_IFLAGS: IFlags = IFlags {
skip_bytes: false, skip_bytes: false,
}; };
const DEFAULT_OFLAGS: OFlags = OFlags { // const DEFAULT_OFLAGS: OFlags = OFlags {
append: false, // append: false,
cio: false, // cio: false,
direct: false, // direct: false,
directory: false, // directory: false,
dsync: false, // dsync: false,
sync: false, // sync: false,
nocache: false, // nocache: false,
nonblock: false, // nonblock: false,
noatime: false, // noatime: false,
noctty: false, // noctty: false,
nofollow: false, // nofollow: false,
nolinks: false, // nolinks: false,
binary: false, // binary: false,
text: false, // text: false,
seek_bytes: false, // seek_bytes: false,
}; // };
struct LazyReader<R: Read> { struct LazyReader<R: Read> {
src: R, src: R,
@ -109,7 +109,6 @@ macro_rules! make_spec_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: 512, obs: 512,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
$spec, $spec,
format!("./test-resources/FAILED-{}.test", $test_name) format!("./test-resources/FAILED-{}.test", $test_name)

View file

@ -12,7 +12,6 @@ macro_rules! make_io_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: $o.obs, obs: $o.obs,
cflags: $o.cflags, cflags: $o.cflags,
oflags: $o.oflags,
}, },
$spec, $spec,
format!("./test-resources/FAILED-{}.test", $test_name) format!("./test-resources/FAILED-{}.test", $test_name)
@ -60,7 +59,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1031, obs: 1031,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap() File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
); );
@ -81,7 +79,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 521, obs: 521,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap() File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
); );
@ -102,7 +99,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1024, obs: 1024,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap() File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap()
); );
@ -123,7 +119,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1031, obs: 1031,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap() File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap()
); );
@ -144,7 +139,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1031, obs: 1031,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/gnudd-deadbeef-first-16k.spec").unwrap() File::open("./test-resources/gnudd-deadbeef-first-16k.spec").unwrap()
); );
@ -165,7 +159,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1031, obs: 1031,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/gnudd-deadbeef-first-12345.spec").unwrap() File::open("./test-resources/gnudd-deadbeef-first-12345.spec").unwrap()
); );
@ -186,7 +179,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1024, obs: 1024,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/gnudd-random-first-32k.spec").unwrap() File::open("./test-resources/gnudd-random-first-32k.spec").unwrap()
); );
@ -207,7 +199,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1031, obs: 1031,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/gnudd-random-first-32k.spec").unwrap() File::open("./test-resources/gnudd-random-first-32k.spec").unwrap()
); );
@ -248,7 +239,6 @@ make_io_test!(
dst: DST_PLACEHOLDER, dst: DST_PLACEHOLDER,
obs: 1031, obs: 1031,
cflags: DEFAULT_CFO, cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
}, },
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap() File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
); );

View file

@ -133,18 +133,31 @@ enum Flag {
CountBytes, CountBytes,
SkipBytes, SkipBytes,
// Either // Either
#[allow(unused)]
Cio, Cio,
#[allow(unused)]
Direct, Direct,
#[allow(unused)]
Directory, Directory,
#[allow(unused)]
Dsync, Dsync,
#[allow(unused)]
Sync, Sync,
#[allow(unused)]
NoCache, NoCache,
#[allow(unused)]
NonBlock, NonBlock,
#[allow(unused)]
NoATime, NoATime,
#[allow(unused)]
NoCtty, NoCtty,
#[allow(unused)]
NoFollow, NoFollow,
#[allow(unused)]
NoLinks, NoLinks,
#[allow(unused)]
Binary, Binary,
#[allow(unused)]
Text, Text,
// Output only // Output only
Append, Append,