Skip to content

Commit 3bc3b27

Browse files
committed
1 parent 1eea517 commit 3bc3b27

File tree

8 files changed

+34
-33
lines changed

8 files changed

+34
-33
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ ignored_unit_patterns = "allow" # 21
657657
similar_names = "allow" # 20
658658
large_stack_arrays = "allow" # 20
659659
wildcard_imports = "allow" # 18
660-
used_underscore_binding = "allow" # 18
661660
needless_pass_by_value = "allow" # 16
662661
float_cmp = "allow" # 12
663662
items_after_statements = "allow" # 11

src/uu/df/src/filesystem.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ where
121121
impl Filesystem {
122122
// TODO: resolve uuid in `mount_info.dev_name` if exists
123123
pub(crate) fn new(mount_info: MountInfo, file: Option<OsString>) -> Option<Self> {
124-
let _stat_path = if mount_info.mount_dir.is_empty() {
124+
let stat_path = if mount_info.mount_dir.is_empty() {
125125
#[cfg(unix)]
126126
{
127127
mount_info.dev_name.clone().into()
@@ -135,9 +135,9 @@ impl Filesystem {
135135
mount_info.mount_dir.clone()
136136
};
137137
#[cfg(unix)]
138-
let usage = FsUsage::new(statfs(&_stat_path).ok()?);
138+
let usage = FsUsage::new(statfs(&stat_path).ok()?);
139139
#[cfg(windows)]
140-
let usage = FsUsage::new(Path::new(&_stat_path)).ok()?;
140+
let usage = FsUsage::new(Path::new(&stat_path)).ok()?;
141141
Some(Self {
142142
file,
143143
mount_info,

src/uu/env/src/env.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -755,20 +755,18 @@ impl EnvAppData {
755755
let arg0 = prog.clone();
756756
let args = &opts.program[1..];
757757

758-
if let Some(_argv0) = opts.argv0 {
759-
#[cfg(unix)]
760-
{
761-
arg0 = Cow::Borrowed(_argv0);
758+
if let Some(argv0) = opts.argv0 {
759+
if cfg!(unix) {
760+
arg0 = Cow::Borrowed(argv0);
762761
if do_debug_printing {
763762
eprintln!("argv0: {}", arg0.quote());
764763
}
764+
} else {
765+
return Err(USimpleError::new(
766+
2,
767+
translate!("env-error-argv0-not-supported"),
768+
));
765769
}
766-
767-
#[cfg(not(unix))]
768-
return Err(USimpleError::new(
769-
2,
770-
translate!("env-error-argv0-not-supported"),
771-
));
772770
}
773771

774772
if do_debug_printing {

src/uu/split/src/platform/unix.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ impl Write for FilterWriter {
4343
/// Have an environment variable set at a value during this lifetime
4444
struct WithEnvVarSet {
4545
/// Env var key
46-
_previous_var_key: String,
46+
previous_var_key: String,
4747
/// Previous value set to this key
48-
_previous_var_value: std::result::Result<String, env::VarError>,
48+
previous_var_value: std::result::Result<String, env::VarError>,
4949
}
5050
impl WithEnvVarSet {
5151
/// Save previous value assigned to key, set key=value
@@ -55,22 +55,22 @@ impl WithEnvVarSet {
5555
env::set_var(key, value);
5656
}
5757
Self {
58-
_previous_var_key: String::from(key),
59-
_previous_var_value: previous_env_value,
58+
previous_var_key: String::from(key),
59+
previous_var_value: previous_env_value,
6060
}
6161
}
6262
}
6363

6464
impl Drop for WithEnvVarSet {
6565
/// Restore previous value now that this is being dropped by context
6666
fn drop(&mut self) {
67-
if let Ok(ref prev_value) = self._previous_var_value {
67+
if let Ok(ref prev_value) = self.previous_var_value {
6868
unsafe {
69-
env::set_var(&self._previous_var_key, prev_value);
69+
env::set_var(&self.previous_var_key, prev_value);
7070
}
7171
} else {
7272
unsafe {
73-
env::remove_var(&self._previous_var_key);
73+
env::remove_var(&self.previous_var_key);
7474
}
7575
}
7676
}

src/uu/stat/src/stat.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,8 @@ impl Stater {
10041004
file: &OsString,
10051005
file_type: &FileType,
10061006
from_user: bool,
1007-
_follow_symbolic_links: bool,
1007+
#[cfg(feature = "selinux")] follow_symbolic_links: bool,
1008+
#[cfg(not(feature = "selinux"))] _: bool,
10081009
) -> Result<(), i32> {
10091010
match *t {
10101011
Token::Byte(byte) => write_raw_byte(byte),
@@ -1035,7 +1036,7 @@ impl Stater {
10351036
if uucore::selinux::is_selinux_enabled() {
10361037
match uucore::selinux::get_selinux_security_context(
10371038
Path::new(file),
1038-
_follow_symbolic_links,
1039+
follow_symbolic_links,
10391040
) {
10401041
Ok(ctx) => OutputType::Str(ctx),
10411042
Err(_) => OutputType::Str(translate!(

src/uu/tail/src/paths.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ impl MetadataExtTail for Metadata {
179179
Ok(other.len() < self.len() && other.modified()? != self.modified()?)
180180
}
181181

182-
fn file_id_eq(&self, _other: &Metadata) -> bool {
182+
fn file_id_eq(&self, #[cfg(unix)] other: &Metadata, #[cfg(not(unix))] _: &Metadata) -> bool {
183183
#[cfg(unix)]
184184
{
185-
self.ino().eq(&_other.ino())
185+
self.ino().eq(&other.ino())
186186
}
187187
#[cfg(windows)]
188188
{

src/uucore/src/lib/features/fs.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,13 +765,16 @@ pub mod sane_blksize {
765765
///
766766
/// If the metadata contain invalid values a meaningful adaption
767767
/// of that value is done.
768-
pub fn sane_blksize_from_metadata(_metadata: &std::fs::Metadata) -> u64 {
769-
#[cfg(not(target_os = "windows"))]
768+
pub fn sane_blksize_from_metadata(
769+
#[cfg(unix)] metadata: &std::fs::Metadata,
770+
#[cfg(not(unix))] _: &std::fs::Metadata,
771+
) -> u64 {
772+
#[cfg(unix)]
770773
{
771-
sane_blksize(_metadata.blksize())
774+
sane_blksize(metadata.blksize())
772775
}
773776

774-
#[cfg(target_os = "windows")]
777+
#[cfg(not(unix))]
775778
{
776779
DEFAULT
777780
}

src/uucore/src/lib/features/sum.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ impl Digest for Bsd {
284284
}
285285

286286
fn result(&mut self) -> DigestOutput {
287-
let mut _out = [0; 2];
288-
self.hash_finalize(&mut _out);
287+
let mut out = [0; 2];
288+
self.hash_finalize(&mut out);
289289
DigestOutput::U16(self.state)
290290
}
291291

@@ -319,8 +319,8 @@ impl Digest for SysV {
319319
}
320320

321321
fn result(&mut self) -> DigestOutput {
322-
let mut _out = [0; 2];
323-
self.hash_finalize(&mut _out);
322+
let mut out = [0; 2];
323+
self.hash_finalize(&mut out);
324324
DigestOutput::U16((self.state & (u16::MAX as u32)) as u16)
325325
}
326326

0 commit comments

Comments
 (0)