Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions file/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct Args {
}

/// Errors that can occur during parsing of a raw magic line.
#[allow(clippy::enum_variant_names)]
#[derive(Debug)]
enum RawMagicLineParseError {
/// Indicates that the offset format is invalid.
Expand Down
19 changes: 10 additions & 9 deletions tree/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ struct LongFormatOptions {
enum OutputFormat {
MultiColumn,
MultiColumnAcross,
StreamOutputFormat,
Stream,
OneEntryPerLine,
LongFormat(LongFormatOptions),
Long(LongFormatOptions),
}

enum SortBy {
Expand All @@ -320,6 +320,7 @@ enum DereferenceSymbolicLink {
None,
}

#[allow(clippy::enum_variant_names)]
enum FileTimeOption {
LastModificationTime,
LastStatusChangeTime,
Expand Down Expand Up @@ -451,7 +452,7 @@ impl Config {
) {
(false, false, false, false) => {
if long_format_enabled {
OutputFormat::LongFormat(long_format_options)
OutputFormat::Long(long_format_options)
} else {
// According to the specification:
//
Expand All @@ -464,7 +465,7 @@ impl Config {
}
}
(true, false, false, false) => OutputFormat::MultiColumn,
(false, true, false, false) => OutputFormat::StreamOutputFormat,
(false, true, false, false) => OutputFormat::Stream,
(false, false, true, false) => OutputFormat::MultiColumnAcross,
(false, false, false, true) => OutputFormat::OneEntryPerLine,
_ => unreachable!(), // -C, -m, -x, and -1 are mutually exclusive
Expand Down Expand Up @@ -718,7 +719,7 @@ fn display_entries(entries: &mut [Entry], config: &Config, dir_path: Option<&str
}

let mut display_total_size = config.display_size;
if let OutputFormat::LongFormat(_) = &config.output_format {
if let OutputFormat::Long(_) = &config.output_format {
display_total_size = true;
}

Expand All @@ -743,7 +744,7 @@ fn display_entries(entries: &mut [Entry], config: &Config, dir_path: Option<&str
}

match &config.output_format {
OutputFormat::LongFormat(_) => {
OutputFormat::Long(_) => {
let mut padding = LongFormatPadding::default();

// Calculate required padding
Expand Down Expand Up @@ -829,7 +830,7 @@ fn display_entries(entries: &mut [Entry], config: &Config, dir_path: Option<&str
println!();
}
}
OutputFormat::StreamOutputFormat => {
OutputFormat::Stream => {
let stream_outputs: Vec<_> = entries
.iter()
.map(|entry| entry.build_stream_mode_string())
Expand Down Expand Up @@ -962,7 +963,7 @@ fn ls(paths: Vec<PathBuf>, config: &Config) -> io::Result<u8> {
let target_path = {
let mut target_path = None;
if metadata.is_symlink() && !dereference_symlink {
if let OutputFormat::LongFormat(_) = &config.output_format {
if let OutputFormat::Long(_) = &config.output_format {
let mut buf = vec![0u8; libc::PATH_MAX as usize];

let path_cstr = CString::new(path.as_os_str().as_bytes()).unwrap();
Expand Down Expand Up @@ -1174,7 +1175,7 @@ fn process_single_dir(

let mut target_path = None;
if metadata.is_symlink() && !dereference_symlink {
if let OutputFormat::LongFormat(_) = &config.output_format {
if let OutputFormat::Long(_) = &config.output_format {
target_path = Some(ls_from_utf8_lossy(
dir_entry.read_link().unwrap().to_bytes(),
));
Expand Down
2 changes: 1 addition & 1 deletion tree/ls_util/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Entry {
};

let long_format_data =
if let OutputFormat::LongFormat(long_format_options) = &config.output_format {
if let OutputFormat::Long(long_format_options) = &config.output_format {
Some(LongFormatData::new(metadata, long_format_options)?)
} else {
None
Expand Down