mirror of
https://github.com/eza-community/eza.git
synced 2025-12-23 05:36:50 +00:00
fix: replace rustfmt::skip on expressions because experimental
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
This commit is contained in:
parent
f555d42972
commit
186cc8e81b
23 changed files with 166 additions and 134 deletions
|
|
@ -349,7 +349,7 @@ fn reorient(path: &Path) -> PathBuf {
|
|||
/// The character to display if the file has been modified, but not staged.
|
||||
fn working_tree_status(status: git2::Status) -> f::GitStatus {
|
||||
#[rustfmt::skip]
|
||||
match status {
|
||||
return match status {
|
||||
s if s.contains(git2::Status::WT_NEW) => f::GitStatus::New,
|
||||
s if s.contains(git2::Status::WT_MODIFIED) => f::GitStatus::Modified,
|
||||
s if s.contains(git2::Status::WT_DELETED) => f::GitStatus::Deleted,
|
||||
|
|
@ -358,21 +358,21 @@ fn working_tree_status(status: git2::Status) -> f::GitStatus {
|
|||
s if s.contains(git2::Status::IGNORED) => f::GitStatus::Ignored,
|
||||
s if s.contains(git2::Status::CONFLICTED) => f::GitStatus::Conflicted,
|
||||
_ => f::GitStatus::NotModified,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// The character to display if the file has been modified and the change
|
||||
/// has been staged.
|
||||
fn index_status(status: git2::Status) -> f::GitStatus {
|
||||
#[rustfmt::skip]
|
||||
match status {
|
||||
return match status {
|
||||
s if s.contains(git2::Status::INDEX_NEW) => f::GitStatus::New,
|
||||
s if s.contains(git2::Status::INDEX_MODIFIED) => f::GitStatus::Modified,
|
||||
s if s.contains(git2::Status::INDEX_DELETED) => f::GitStatus::Deleted,
|
||||
s if s.contains(git2::Status::INDEX_RENAMED) => f::GitStatus::Renamed,
|
||||
s if s.contains(git2::Status::INDEX_TYPECHANGE) => f::GitStatus::TypeChange,
|
||||
_ => f::GitStatus::NotModified,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn current_branch(repo: &git2::Repository) -> Option<String> {
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ impl SortField {
|
|||
use self::SortCase::{ABCabc, AaBbCc};
|
||||
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
return match self {
|
||||
Self::Unsorted => Ordering::Equal,
|
||||
|
||||
Self::Name(ABCabc) => natord::compare(&a.name, &b.name),
|
||||
|
|
@ -270,7 +270,7 @@ impl SortField {
|
|||
Self::strip_dot(&a.name),
|
||||
Self::strip_dot(&b.name)
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn strip_dot(n: &str) -> &str {
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ impl log::Log for Logger {
|
|||
|
||||
fn level(level: log::Level) -> ANSIString<'static> {
|
||||
#[rustfmt::skip]
|
||||
match level {
|
||||
return match level {
|
||||
log::Level::Error => Colour::Red.paint("ERROR"),
|
||||
log::Level::Warn => Colour::Yellow.paint("WARN"),
|
||||
log::Level::Info => Colour::Cyan.paint("INFO"),
|
||||
log::Level::Debug => Colour::Blue.paint("DEBUG"),
|
||||
log::Level::Trace => Colour::Fixed(245).paint("TRACE"),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,15 @@ impl DirAction {
|
|||
let as_file = matches.has(&flags::LIST_DIRS)?;
|
||||
let tree = matches.has(&flags::TREE)?;
|
||||
|
||||
#[rustfmt::skip]
|
||||
if matches.is_strict() {
|
||||
// Early check for --level when it wouldn’t do anything
|
||||
if ! recurse && ! tree && matches.count(&flags::LEVEL) > 0 {
|
||||
return Err(OptionsError::Useless2(&flags::LEVEL, &flags::RECURSE, &flags::TREE));
|
||||
}
|
||||
else if recurse && as_file {
|
||||
if !recurse && !tree && matches.count(&flags::LEVEL) > 0 {
|
||||
return Err(OptionsError::Useless2(
|
||||
&flags::LEVEL,
|
||||
&flags::RECURSE,
|
||||
&flags::TREE,
|
||||
));
|
||||
} else if recurse && as_file {
|
||||
return Err(OptionsError::Conflict(&flags::RECURSE, &flags::LIST_DIRS));
|
||||
} else if tree && as_file {
|
||||
return Err(OptionsError::Conflict(&flags::TREE, &flags::LIST_DIRS));
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ impl fmt::Display for OptionsError {
|
|||
use crate::options::parser::TakesValue;
|
||||
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
return match self {
|
||||
Self::BadArgument(arg, attempt) => {
|
||||
if let TakesValue::Necessary(Some(values)) = arg.takes_value {
|
||||
write!(
|
||||
|
|
@ -96,7 +96,7 @@ impl fmt::Display for OptionsError {
|
|||
Self::TreeAllAll => write!(f, "Option --tree is useless given --all --all"),
|
||||
Self::FailedParse(s, n, e) => write!(f, "Value {s:?} not valid for {n}: {e}"),
|
||||
Self::FailedGlobPattern(ref e) => write!(f, "Failed to parse glob pattern: {e}"),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ impl FileFilter {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
Ok(Self {
|
||||
return Ok(Self {
|
||||
list_dirs_first: matches.has(&flags::DIRS_FIRST)?,
|
||||
flags: filter_flags,
|
||||
sort_field: SortField::deduce(matches)?,
|
||||
dot_filter: DotFilter::deduce(matches)?,
|
||||
ignore_patterns: IgnorePatterns::deduce(matches)?,
|
||||
git_ignore: GitIgnore::deduce(matches)?,
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![rustfmt::skip] // the entire file becomes less readable with rustfmt
|
||||
use crate::options::parser::{Arg, Args, TakesValue, Values};
|
||||
|
||||
// exa options
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ use crate::theme::Options as ThemeOptions;
|
|||
mod dir_action;
|
||||
mod file_name;
|
||||
mod filter;
|
||||
#[rustfmt::skip] // this module becomes unreadable with rustfmt
|
||||
mod flags;
|
||||
mod theme;
|
||||
mod view;
|
||||
|
|
|
|||
|
|
@ -351,6 +351,7 @@ impl TimeTypes {
|
|||
|
||||
let no_time = matches.has(&flags::NO_TIME)?;
|
||||
|
||||
#[rustfmt::skip]
|
||||
let time_types = if no_time {
|
||||
Self {
|
||||
modified: false,
|
||||
|
|
@ -359,7 +360,6 @@ impl TimeTypes {
|
|||
created: false,
|
||||
}
|
||||
} else if let Some(word) = possible_word {
|
||||
#[rustfmt::skip]
|
||||
if modified {
|
||||
return Err(OptionsError::Useless(&flags::MODIFIED, true, &flags::TIME));
|
||||
} else if changed {
|
||||
|
|
|
|||
|
|
@ -64,10 +64,9 @@ impl TextCell {
|
|||
/// This is used in place of empty table cells, as it is easier to read
|
||||
/// tabular data when there is *something* in each cell.
|
||||
pub fn blank(style: Style) -> Self {
|
||||
#[rustfmt::skip]
|
||||
Self {
|
||||
contents: vec![ style.paint("-") ].into(),
|
||||
width: DisplayWidth::from(1),
|
||||
contents: vec![style.paint("-")].into(),
|
||||
width: DisplayWidth::from(1),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,11 +161,18 @@ impl<'a> Render<'a> {
|
|||
let mut rows = Vec::new();
|
||||
|
||||
if let Some(ref table) = self.opts.table {
|
||||
#[rustfmt::skip]
|
||||
match (self.git, self.dir) {
|
||||
(Some(g), Some(d)) => if ! g.has_anything_for(&d.path) { self.git = None },
|
||||
(Some(g), None) => if ! self.files.iter().any(|f| g.has_anything_for(&f.path)) { self.git = None },
|
||||
(None, _) => {/* Keep Git how it is */},
|
||||
(Some(g), Some(d)) => {
|
||||
if !g.has_anything_for(&d.path) {
|
||||
self.git = None
|
||||
}
|
||||
}
|
||||
(Some(g), None) => {
|
||||
if !self.files.iter().any(|f| g.has_anything_for(&f.path)) {
|
||||
self.git = None
|
||||
}
|
||||
}
|
||||
(None, _) => { /* Keep Git how it is */ }
|
||||
}
|
||||
|
||||
let mut table = Table::new(table, self.git, self.theme);
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
match self.file {
|
||||
return match self.file {
|
||||
f if f.is_mount_point() => self.colours.mount_point(),
|
||||
f if f.is_directory() => self.colours.directory(),
|
||||
#[cfg(unix)]
|
||||
|
|
@ -414,7 +414,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|||
f if f.is_socket() => self.colours.socket(),
|
||||
f if ! f.is_file() => self.colours.special(),
|
||||
_ => self.colours.colour_file(self.file),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// For grid's use, to cover the case of hyperlink escape sequences
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ impl<'a> Render<'a> {
|
|||
/// *n* files into each column’s table, not all of them.
|
||||
fn details_for_column(&self) -> DetailsRender<'a> {
|
||||
#[rustfmt::skip]
|
||||
DetailsRender {
|
||||
return DetailsRender {
|
||||
dir: self.dir,
|
||||
files: Vec::new(),
|
||||
theme: self.theme,
|
||||
|
|
@ -106,7 +106,7 @@ impl<'a> Render<'a> {
|
|||
filter: self.filter,
|
||||
git_ignoring: self.git_ignoring,
|
||||
git: self.git,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Create a Details render for when this grid-details render doesn’t fit
|
||||
|
|
@ -115,7 +115,7 @@ impl<'a> Render<'a> {
|
|||
/// not available, so we downgrade.
|
||||
pub fn give_up(self) -> DetailsRender<'a> {
|
||||
#[rustfmt::skip]
|
||||
DetailsRender {
|
||||
return DetailsRender {
|
||||
dir: self.dir,
|
||||
files: self.files,
|
||||
theme: self.theme,
|
||||
|
|
@ -125,7 +125,7 @@ impl<'a> Render<'a> {
|
|||
filter: self.filter,
|
||||
git_ignoring: self.git_ignoring,
|
||||
git: self.git,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// This doesn’t take an IgnoreCache even though the details one does
|
||||
|
|
@ -229,11 +229,18 @@ impl<'a> Render<'a> {
|
|||
options: &'a TableOptions,
|
||||
drender: &DetailsRender<'_>,
|
||||
) -> (Table<'a>, Vec<DetailsRow>) {
|
||||
#[rustfmt::skip]
|
||||
match (self.git, self.dir) {
|
||||
(Some(g), Some(d)) => if ! g.has_anything_for(&d.path) { self.git = None },
|
||||
(Some(g), None) => if ! self.files.iter().any(|f| g.has_anything_for(&f.path)) { self.git = None },
|
||||
(None, _) => {/* Keep Git how it is */},
|
||||
(Some(g), Some(d)) => {
|
||||
if !g.has_anything_for(&d.path) {
|
||||
self.git = None
|
||||
}
|
||||
}
|
||||
(Some(g), None) => {
|
||||
if !self.files.iter().any(|f| g.has_anything_for(&f.path)) {
|
||||
self.git = None
|
||||
}
|
||||
}
|
||||
(None, _) => { /* Keep Git how it is */ }
|
||||
}
|
||||
|
||||
let mut table = Table::new(options, self.git, self.theme);
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ impl TerminalWidth {
|
|||
// where the output goes.
|
||||
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
return match self {
|
||||
Self::Set(width) => Some(width),
|
||||
Self::Automatic => terminal_size::terminal_size().map(|(w, _)| w.0.into()),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use crate::fs::fields as f;
|
|||
impl f::Type {
|
||||
pub fn render<C: Colours>(self, colours: &C) -> ANSIString<'static> {
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
return match self {
|
||||
Self::File => colours.normal().paint("."),
|
||||
Self::Directory => colours.directory().paint("d"),
|
||||
Self::Pipe => colours.pipe().paint("|"),
|
||||
|
|
@ -14,7 +14,7 @@ impl f::Type {
|
|||
Self::CharDevice => colours.char_device().paint("c"),
|
||||
Self::Socket => colours.socket().paint("s"),
|
||||
Self::Special => colours.special().paint("?"),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ impl f::Git {
|
|||
impl f::GitStatus {
|
||||
fn render(self, colours: &dyn Colours) -> ANSIString<'static> {
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
return match self {
|
||||
Self::NotModified => colours.not_modified().paint("-"),
|
||||
Self::New => colours.new().paint("N"),
|
||||
Self::Modified => colours.modified().paint("M"),
|
||||
|
|
@ -24,7 +24,7 @@ impl f::GitStatus {
|
|||
Self::TypeChange => colours.type_change().paint("T"),
|
||||
Self::Ignored => colours.ignored().paint("I"),
|
||||
Self::Conflicted => colours.conflicted().paint("U"),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,18 +9,37 @@ pub trait Render {
|
|||
|
||||
impl Render for Option<f::OctalPermissions> {
|
||||
fn render(&self, style: Style) -> TextCell {
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
Some(p) => {
|
||||
let perm = &p.permissions;
|
||||
let octal_sticky = f::OctalPermissions::bits_to_octal(perm.setuid, perm.setgid, perm.sticky);
|
||||
let octal_owner = f::OctalPermissions::bits_to_octal(perm.user_read, perm.user_write, perm.user_execute);
|
||||
let octal_group = f::OctalPermissions::bits_to_octal(perm.group_read, perm.group_write, perm.group_execute);
|
||||
let octal_other = f::OctalPermissions::bits_to_octal(perm.other_read, perm.other_write, perm.other_execute);
|
||||
#[rustfmt::skip]
|
||||
let octal_sticky = f::OctalPermissions::bits_to_octal(
|
||||
perm.setuid,
|
||||
perm.setgid,
|
||||
perm.sticky
|
||||
);
|
||||
let octal_owner = f::OctalPermissions::bits_to_octal(
|
||||
perm.user_read,
|
||||
perm.user_write,
|
||||
perm.user_execute,
|
||||
);
|
||||
let octal_group = f::OctalPermissions::bits_to_octal(
|
||||
perm.group_read,
|
||||
perm.group_write,
|
||||
perm.group_execute,
|
||||
);
|
||||
let octal_other = f::OctalPermissions::bits_to_octal(
|
||||
perm.other_read,
|
||||
perm.other_write,
|
||||
perm.other_execute,
|
||||
);
|
||||
|
||||
TextCell::paint(style, format!("{octal_sticky}{octal_owner}{octal_group}{octal_other}"))
|
||||
},
|
||||
None => TextCell::paint(style, "----".into())
|
||||
TextCell::paint(
|
||||
style,
|
||||
format!("{octal_sticky}{octal_owner}{octal_group}{octal_other}"),
|
||||
)
|
||||
}
|
||||
None => TextCell::paint(style, "----".into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,17 +77,16 @@ impl RenderPermissions for Option<f::Permissions> {
|
|||
}
|
||||
};
|
||||
|
||||
#[rustfmt::skip]
|
||||
vec![
|
||||
bit(p.user_read, "r", colours.user_read()),
|
||||
bit(p.user_write, "w", colours.user_write()),
|
||||
bit(p.user_read, "r", colours.user_read()),
|
||||
bit(p.user_write, "w", colours.user_write()),
|
||||
p.user_execute_bit(colours, is_regular_file),
|
||||
bit(p.group_read, "r", colours.group_read()),
|
||||
bit(p.group_read, "r", colours.group_read()),
|
||||
bit(p.group_write, "w", colours.group_write()),
|
||||
p.group_execute_bit(colours),
|
||||
bit(p.other_read, "r", colours.other_read()),
|
||||
bit(p.other_read, "r", colours.other_read()),
|
||||
bit(p.other_write, "w", colours.other_write()),
|
||||
p.other_execute_bit(colours)
|
||||
p.other_execute_bit(colours),
|
||||
]
|
||||
}
|
||||
None => iter::repeat(colours.dash().paint("-")).take(9).collect(),
|
||||
|
|
@ -102,34 +101,34 @@ impl f::Permissions {
|
|||
is_regular_file: bool,
|
||||
) -> ANSIString<'static> {
|
||||
#[rustfmt::skip]
|
||||
match (self.user_execute, self.setuid, is_regular_file) {
|
||||
return match (self.user_execute, self.setuid, is_regular_file) {
|
||||
(false, false, _) => colours.dash().paint("-"),
|
||||
(true, false, false) => colours.user_execute_other().paint("x"),
|
||||
(true, false, true) => colours.user_execute_file().paint("x"),
|
||||
(false, true, _) => colours.special_other().paint("S"),
|
||||
(true, true, false) => colours.special_other().paint("s"),
|
||||
(true, true, true) => colours.special_user_file().paint("s"),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn group_execute_bit<C: Colours>(&self, colours: &C) -> ANSIString<'static> {
|
||||
#[rustfmt::skip]
|
||||
match (self.group_execute, self.setgid) {
|
||||
return match (self.group_execute, self.setgid) {
|
||||
(false, false) => colours.dash().paint("-"),
|
||||
(true, false) => colours.group_execute().paint("x"),
|
||||
(false, true) => colours.special_other().paint("S"),
|
||||
(true, true) => colours.special_other().paint("s"),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn other_execute_bit<C: Colours>(&self, colours: &C) -> ANSIString<'static> {
|
||||
#[rustfmt::skip]
|
||||
match (self.other_execute, self.sticky) {
|
||||
return match (self.other_execute, self.sticky) {
|
||||
(false, false) => colours.dash().paint("-"),
|
||||
(true, false) => colours.other_execute().paint("x"),
|
||||
(false, true) => colours.special_other().paint("T"),
|
||||
(true, true) => colours.special_other().paint("t"),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,15 +168,11 @@ impl Column {
|
|||
#[cfg(unix)]
|
||||
pub fn alignment(self) -> Alignment {
|
||||
#[allow(clippy::wildcard_in_or_patterns)]
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
Self::FileSize |
|
||||
Self::HardLinks |
|
||||
Self::Inode |
|
||||
Self::Blocksize |
|
||||
Self::GitStatus => Alignment::Right,
|
||||
Self::Timestamp(_) |
|
||||
_ => Alignment::Left,
|
||||
Self::FileSize | Self::HardLinks | Self::Inode | Self::Blocksize | Self::GitStatus => {
|
||||
Alignment::Right
|
||||
}
|
||||
Self::Timestamp(_) | _ => Alignment::Left,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,28 +189,27 @@ impl Column {
|
|||
/// Get the text that should be printed at the top, when the user elects
|
||||
/// to have a header row printed.
|
||||
pub fn header(self) -> &'static str {
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
#[cfg(unix)]
|
||||
Self::Permissions => "Permissions",
|
||||
Self::Permissions => "Permissions",
|
||||
#[cfg(windows)]
|
||||
Self::Permissions => "Mode",
|
||||
Self::FileSize => "Size",
|
||||
Self::Timestamp(t) => t.header(),
|
||||
Self::Permissions => "Mode",
|
||||
Self::FileSize => "Size",
|
||||
Self::Timestamp(t) => t.header(),
|
||||
#[cfg(unix)]
|
||||
Self::Blocksize => "Blocksize",
|
||||
Self::Blocksize => "Blocksize",
|
||||
#[cfg(unix)]
|
||||
Self::User => "User",
|
||||
Self::User => "User",
|
||||
#[cfg(unix)]
|
||||
Self::Group => "Group",
|
||||
Self::Group => "Group",
|
||||
#[cfg(unix)]
|
||||
Self::HardLinks => "Links",
|
||||
Self::HardLinks => "Links",
|
||||
#[cfg(unix)]
|
||||
Self::Inode => "inode",
|
||||
Self::GitStatus => "Git",
|
||||
Self::Inode => "inode",
|
||||
Self::GitStatus => "Git",
|
||||
Self::SubdirGitRepo(_) => "Repo",
|
||||
#[cfg(unix)]
|
||||
Self::Octal => "Octal",
|
||||
Self::Octal => "Octal",
|
||||
#[cfg(unix)]
|
||||
Self::SecurityContext => "Security Context",
|
||||
}
|
||||
|
|
@ -272,12 +267,11 @@ pub enum TimeType {
|
|||
impl TimeType {
|
||||
/// Returns the text to use for a column’s heading in the columns output.
|
||||
pub fn header(self) -> &'static str {
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
Self::Modified => "Date Modified",
|
||||
Self::Changed => "Date Changed",
|
||||
Self::Accessed => "Date Accessed",
|
||||
Self::Created => "Date Created",
|
||||
Self::Modified => "Date Modified",
|
||||
Self::Changed => "Date Changed",
|
||||
Self::Accessed => "Date Accessed",
|
||||
Self::Created => "Date Created",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -301,12 +295,11 @@ impl Default for TimeTypes {
|
|||
/// By default, display just the ‘modified’ time. This is the most
|
||||
/// common option, which is why it has this shorthand.
|
||||
fn default() -> Self {
|
||||
#[rustfmt::skip]
|
||||
Self {
|
||||
modified: true,
|
||||
changed: false,
|
||||
changed: false,
|
||||
accessed: false,
|
||||
created: false,
|
||||
created: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -446,22 +439,15 @@ impl<'a> Table<'a> {
|
|||
}
|
||||
|
||||
fn display(&self, file: &File<'_>, column: Column, xattrs: bool) -> TextCell {
|
||||
#[rustfmt::skip]
|
||||
match column {
|
||||
Column::Permissions => {
|
||||
self.permissions_plus(file, xattrs).render(self.theme)
|
||||
}
|
||||
Column::FileSize => {
|
||||
file.size().render(self.theme, self.size_format, &self.env.numeric)
|
||||
}
|
||||
Column::Permissions => self.permissions_plus(file, xattrs).render(self.theme),
|
||||
Column::FileSize => file
|
||||
.size()
|
||||
.render(self.theme, self.size_format, &self.env.numeric),
|
||||
#[cfg(unix)]
|
||||
Column::HardLinks => {
|
||||
file.links().render(self.theme, &self.env.numeric)
|
||||
}
|
||||
Column::HardLinks => file.links().render(self.theme, &self.env.numeric),
|
||||
#[cfg(unix)]
|
||||
Column::Inode => {
|
||||
file.inode().render(self.theme.ui.inode)
|
||||
}
|
||||
Column::Inode => file.inode().render(self.theme.ui.inode),
|
||||
#[cfg(unix)]
|
||||
Column::Blocksize => {
|
||||
file.blocksize()
|
||||
|
|
@ -478,6 +464,7 @@ impl<'a> Table<'a> {
|
|||
.render(self.theme, &*self.env.lock_users(), self.user_format)
|
||||
}
|
||||
#[cfg(unix)]
|
||||
<<<<<<< HEAD
|
||||
Column::SecurityContext => {
|
||||
file.security_context().render(self.theme)
|
||||
}
|
||||
|
|
@ -487,23 +474,35 @@ impl<'a> Table<'a> {
|
|||
Column::SubdirGitRepo(status) => {
|
||||
self.subdir_git_repo(file, status).render(self.theme)
|
||||
}
|
||||
=======
|
||||
Column::SecurityContext => file.security_context().render(self.theme),
|
||||
Column::GitStatus => self.git_status(file).render(self.theme),
|
||||
Column::SubdirGitRepoStatus => self.subdir_git_repo(file, true).render(),
|
||||
Column::SubdirGitRepoNoStatus => self.subdir_git_repo(file, false).render(),
|
||||
>>>>>>> 516ee70a (fix: replace rustfmt::skip on expressions because experimental)
|
||||
#[cfg(unix)]
|
||||
Column::Octal => {
|
||||
self.octal_permissions(file).render(self.theme.ui.octal)
|
||||
}
|
||||
Column::Octal => self.octal_permissions(file).render(self.theme.ui.octal),
|
||||
|
||||
Column::Timestamp(TimeType::Modified) => {
|
||||
file.modified_time().render(self.theme.ui.date, self.env.time_offset, self.time_format)
|
||||
}
|
||||
Column::Timestamp(TimeType::Changed) => {
|
||||
file.changed_time().render(self.theme.ui.date, self.env.time_offset, self.time_format)
|
||||
}
|
||||
Column::Timestamp(TimeType::Created) => {
|
||||
file.created_time().render(self.theme.ui.date, self.env.time_offset, self.time_format)
|
||||
}
|
||||
Column::Timestamp(TimeType::Accessed) => {
|
||||
file.accessed_time().render(self.theme.ui.date, self.env.time_offset, self.time_format)
|
||||
}
|
||||
Column::Timestamp(TimeType::Modified) => file.modified_time().render(
|
||||
self.theme.ui.date,
|
||||
self.env.time_offset,
|
||||
self.time_format,
|
||||
),
|
||||
Column::Timestamp(TimeType::Changed) => file.changed_time().render(
|
||||
self.theme.ui.date,
|
||||
self.env.time_offset,
|
||||
self.time_format,
|
||||
),
|
||||
Column::Timestamp(TimeType::Created) => file.created_time().render(
|
||||
self.theme.ui.date,
|
||||
self.env.time_offset,
|
||||
self.time_format,
|
||||
),
|
||||
Column::Timestamp(TimeType::Accessed) => file.accessed_time().render(
|
||||
self.theme.ui.date,
|
||||
self.env.time_offset,
|
||||
self.time_format,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ pub enum TimeFormat {
|
|||
impl TimeFormat {
|
||||
pub fn format(self, time: &DateTime<FixedOffset>) -> String {
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
return match self {
|
||||
Self::DefaultFormat => default(time),
|
||||
Self::ISOFormat => iso(time),
|
||||
Self::LongISO => long(time),
|
||||
Self::FullISO => full(time),
|
||||
Self::Relative => relative(time),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ impl TreePart {
|
|||
/// (Warning: not actually ASCII)
|
||||
pub fn ascii_art(self) -> &'static str {
|
||||
#[rustfmt::skip]
|
||||
match self {
|
||||
return match self {
|
||||
Self::Edge => "├──",
|
||||
Self::Line => "│ ",
|
||||
Self::Corner => "└──",
|
||||
Self::Blank => " ",
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ struct FileTypes;
|
|||
impl FileStyle for FileTypes {
|
||||
fn get_style(&self, file: &File<'_>, theme: &Theme) -> Option<Style> {
|
||||
#[rustfmt::skip]
|
||||
match FileType::get_file_type(file) {
|
||||
return match FileType::get_file_type(file) {
|
||||
Some(FileType::Image) => Some(theme.ui.file_type.image),
|
||||
Some(FileType::Video) => Some(theme.ui.file_type.video),
|
||||
Some(FileType::Music) => Some(theme.ui.file_type.music),
|
||||
|
|
@ -217,7 +217,7 @@ impl FileStyle for FileTypes {
|
|||
Some(FileType::Compiled) => Some(theme.ui.file_type.compiled),
|
||||
Some(FileType::Build) => Some(theme.ui.file_type.build),
|
||||
None => None
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,26 +227,26 @@ impl render::BlocksColours for Theme {
|
|||
use number_prefix::Prefix::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
match prefix {
|
||||
return match prefix {
|
||||
Some(Kilo | Kibi) => self.ui.size.number_kilo,
|
||||
Some(Mega | Mebi) => self.ui.size.number_mega,
|
||||
Some(Giga | Gibi) => self.ui.size.number_giga,
|
||||
Some(_) => self.ui.size.number_huge,
|
||||
None => self.ui.size.number_byte,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn unit(&self, prefix: Option<number_prefix::Prefix>) -> Style {
|
||||
use number_prefix::Prefix::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
match prefix {
|
||||
return match prefix {
|
||||
Some(Kilo | Kibi) => self.ui.size.unit_kilo,
|
||||
Some(Mega | Mebi) => self.ui.size.unit_mega,
|
||||
Some(Giga | Gibi) => self.ui.size.unit_giga,
|
||||
Some(_) => self.ui.size.unit_huge,
|
||||
None => self.ui.size.unit_byte,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn no_blocksize(&self) -> Style {
|
||||
|
|
@ -325,26 +325,26 @@ impl render::SizeColours for Theme {
|
|||
use number_prefix::Prefix::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
match prefix {
|
||||
return match prefix {
|
||||
Some(Kilo | Kibi) => self.ui.size.number_kilo,
|
||||
Some(Mega | Mebi) => self.ui.size.number_mega,
|
||||
Some(Giga | Gibi) => self.ui.size.number_giga,
|
||||
Some(_) => self.ui.size.number_huge,
|
||||
None => self.ui.size.number_byte,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn unit(&self, prefix: Option<number_prefix::Prefix>) -> Style {
|
||||
use number_prefix::Prefix::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
match prefix {
|
||||
return match prefix {
|
||||
Some(Kilo | Kibi) => self.ui.size.unit_kilo,
|
||||
Some(Mega | Mebi) => self.ui.size.unit_mega,
|
||||
Some(Giga | Gibi) => self.ui.size.unit_giga,
|
||||
Some(_) => self.ui.size.unit_huge,
|
||||
None => self.ui.size.unit_byte,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ impl UiStyles {
|
|||
// Codes we don’t do anything with:
|
||||
// MULTIHARDLINK, DOOR, SETUID, SETGID, CAPABILITY,
|
||||
// STICKY_OTHER_WRITABLE, OTHER_WRITABLE, STICKY, MISSING
|
||||
}
|
||||
};
|
||||
true
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ impl UiStyles {
|
|||
"Sl" => self.security_context.selinux.range = pair.to_style(),
|
||||
|
||||
_ => return false,
|
||||
}
|
||||
};
|
||||
|
||||
true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue