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
pub struct IFlags {
#[allow(dead_code)]
pub cio: bool,
#[allow(dead_code)]
pub direct: bool,
#[allow(dead_code)]
pub directory: bool,
#[allow(dead_code)]
pub dsync: bool,
#[allow(dead_code)]
pub sync: bool,
#[allow(dead_code)]
pub nocache: bool,
#[allow(dead_code)]
pub nonblock: bool,
#[allow(dead_code)]
pub noatime: bool,
#[allow(dead_code)]
pub noctty: bool,
#[allow(dead_code)]
pub nofollow: bool,
#[allow(dead_code)]
pub nolinks: bool,
#[allow(dead_code)]
pub binary: bool,
#[allow(dead_code)]
pub text: bool,
pub fullblock: bool,
pub count_bytes: bool,
@ -89,18 +102,31 @@ pub struct IFlags {
/// Stores all Flags that apply to the output
pub struct OFlags {
pub append: bool,
#[allow(dead_code)]
pub cio: bool,
#[allow(dead_code)]
pub direct: bool,
#[allow(dead_code)]
pub directory: bool,
#[allow(dead_code)]
pub dsync: bool,
#[allow(dead_code)]
pub sync: bool,
#[allow(dead_code)]
pub nocache: bool,
#[allow(dead_code)]
pub nonblock: bool,
#[allow(dead_code)]
pub noatime: bool,
#[allow(dead_code)]
pub noctty: bool,
#[allow(dead_code)]
pub nofollow: bool,
#[allow(dead_code)]
pub nolinks: bool,
#[allow(dead_code)]
pub binary: bool,
#[allow(dead_code)]
pub text: 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::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 BUF_INIT_BYTE: u8 = 0xDD;
const RTN_SUCCESS: i32 = 0;
@ -294,14 +294,12 @@ struct Output<W: Write> {
dst: W,
obs: usize,
cflags: OConvFlags,
oflags: OFlags,
}
impl Output<io::Stdout> {
fn new(matches: &Matches) -> Result<Self, Box<dyn Error>> {
let obs = parseargs::parse_obs(matches)?;
let cflags = parseargs::parse_conv_flag_output(matches)?;
let oflags = parseargs::parse_oflags(matches)?;
let dst = io::stdout();
@ -309,7 +307,6 @@ impl Output<io::Stdout> {
dst,
obs,
cflags,
oflags,
})
}
@ -396,7 +393,6 @@ impl Output<File> {
dst,
obs,
cflags,
oflags,
})
} else {
// 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(),
obs: 512,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
$spec,
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(),
obs: 512,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
$spec,
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(),
obs: $obs,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
$spec,
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(),
obs: 512,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
$spec,
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(),
obs: 512,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
$spec,
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(),
obs: 1024,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
};
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(),
obs: 1024,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
};
dd_fileout(i, o).unwrap();

View file

@ -37,23 +37,23 @@ const DEFAULT_IFLAGS: IFlags = IFlags {
skip_bytes: false,
};
const DEFAULT_OFLAGS: OFlags = OFlags {
append: false,
cio: false,
direct: false,
directory: false,
dsync: false,
sync: false,
nocache: false,
nonblock: false,
noatime: false,
noctty: false,
nofollow: false,
nolinks: false,
binary: false,
text: false,
seek_bytes: false,
};
// const DEFAULT_OFLAGS: OFlags = OFlags {
// append: false,
// cio: false,
// direct: false,
// directory: false,
// dsync: false,
// sync: false,
// nocache: false,
// nonblock: false,
// noatime: false,
// noctty: false,
// nofollow: false,
// nolinks: false,
// binary: false,
// text: false,
// seek_bytes: false,
// };
struct LazyReader<R: Read> {
src: R,
@ -109,7 +109,6 @@ macro_rules! make_spec_test (
dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(),
obs: 512,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
$spec,
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(),
obs: $o.obs,
cflags: $o.cflags,
oflags: $o.oflags,
},
$spec,
format!("./test-resources/FAILED-{}.test", $test_name)
@ -60,7 +59,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1031,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
);
@ -81,7 +79,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 521,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
);
@ -102,7 +99,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1024,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap()
);
@ -123,7 +119,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1031,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/deadbeef-18d99661a1de1fc9af21b0ec2cd67ba3.test").unwrap()
);
@ -144,7 +139,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1031,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/gnudd-deadbeef-first-16k.spec").unwrap()
);
@ -165,7 +159,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1031,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/gnudd-deadbeef-first-12345.spec").unwrap()
);
@ -186,7 +179,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1024,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/gnudd-random-first-32k.spec").unwrap()
);
@ -207,7 +199,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1031,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/gnudd-random-first-32k.spec").unwrap()
);
@ -248,7 +239,6 @@ make_io_test!(
dst: DST_PLACEHOLDER,
obs: 1031,
cflags: DEFAULT_CFO,
oflags: DEFAULT_OFLAGS,
},
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
);

View file

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