Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/uu/du/src/du.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use std::env;
use std::ffi::{OsStr, OsString};
use std::fs::{self, DirEntry, File, Metadata};
use std::io::{BufRead, BufReader, stdout};
use std::io::{BufRead, BufReader, Write, stdout};
#[cfg(not(windows))]
use std::os::unix::fs::MetadataExt;
#[cfg(windows)]
Expand All @@ -20,6 +20,7 @@
use std::str::FromStr;
use std::sync::mpsc;
use std::thread;
use std::{env, io};

Check failure on line 23 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unused import: `env` (file:'src/uu/du/src/du.rs', line:23)

Check failure on line 23 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unused import: `env` (file:'src/uu/du/src/du.rs', line:23)
use thiserror::Error;
use uucore::display::{Quotable, print_verbatim};
use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code};
Expand Down Expand Up @@ -131,7 +132,7 @@
path: &Path,
dir_entry: Option<&DirEntry>,
options: &TraversalOptions,
) -> std::io::Result<Self> {

Check failure on line 135 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:135)

Check failure on line 135 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:135)
// Determine whether to dereference (follow) the symbolic link
let should_dereference = match &options.dereference {
Deref::All => true,
Expand Down Expand Up @@ -165,7 +166,7 @@

/// Create a Stat using safe traversal methods with `DirFd` for the root directory
#[cfg(all(unix, not(target_os = "redox")))]
fn new_from_dirfd(dir_fd: &DirFd, full_path: &Path) -> std::io::Result<Self> {

Check failure on line 169 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:169)

Check failure on line 169 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:169)
// Get metadata for the directory itself using fstat
let safe_metadata = dir_fd.metadata()?;

Expand Down Expand Up @@ -307,7 +308,7 @@
seen_inodes: &mut HashSet<FileInfo>,
print_tx: &mpsc::Sender<UResult<StatPrintInfo>>,
parent_fd: Option<&DirFd>,
initial_stat: Option<std::io::Result<Stat>>,

Check failure on line 311 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:311)

Check failure on line 311 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:311)
) -> Result<Stat, Box<mpsc::SendError<UResult<StatPrintInfo>>>> {
// Get initial stat for this path - use DirFd if available to avoid path length issues
let mut my_stat = if let Some(parent_fd) = parent_fd {
Expand Down Expand Up @@ -627,8 +628,8 @@

// Check symlink depth limit
if current_symlink_depth > MAX_SYMLINK_DEPTH {
print_tx.send(Err(std::io::Error::new(

Check failure on line 631 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:631)

Check failure on line 631 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:631)
std::io::ErrorKind::InvalidData,

Check failure on line 632 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:632)

Check failure on line 632 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:632)
"Too many levels of symbolic links",
).map_err_context(
|| translate!("du-error-cannot-access", "path" => entry_path.quote()),
Expand Down Expand Up @@ -888,7 +889,7 @@
}

fn print_stat(&self, stat: &Stat, size: u64) -> UResult<()> {
print!("{}\t", self.convert_size(size));
write!(io::stdout(), "{}\t", self.convert_size(size))?;

Check failure on line 892 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:892)

Check failure on line 892 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:892)

if let Some(md_time) = &self.time {
if let Some(time) = metadata_get_time(&stat.metadata, *md_time) {
Expand All @@ -904,18 +905,18 @@
}
}

print_verbatim(&stat.path).unwrap();
print!("{}", self.line_ending);
print_verbatim(&stat.path)?;
write!(io::stdout(), "{}", self.line_ending)?;

Check failure on line 909 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:909)

Check failure on line 909 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:909)

Ok(())
}
}

/// Read file paths from the specified file, separated by null characters
fn read_files_from(file_name: &OsStr) -> Result<Vec<PathBuf>, std::io::Error> {

Check failure on line 916 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:916)

Check failure on line 916 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:916)
let reader: Box<dyn BufRead> = if file_name == "-" {
// Read from standard input
Box::new(BufReader::new(std::io::stdin()))

Check failure on line 919 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:919)

Check failure on line 919 in src/uu/du/src/du.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (unix)

ERROR: `cargo clippy`: unnecessary qualification (file:'src/uu/du/src/du.rs', line:919)
} else {
// First, check if the file_name is a directory
let path = PathBuf::from(file_name);
Expand Down
Loading