mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-09-28 13:19:01 +00:00
New set of lints, and Rust 2018 idioms
This commit is contained in:
parent
f42957fab8
commit
3dc86c99ad
@ -1,7 +1,6 @@
|
|||||||
//! Extended attribute support for Darwin and Linux systems.
|
//! Extended attribute support for Darwin and Linux systems.
|
||||||
|
|
||||||
#![allow(trivial_casts)] // for ARM
|
#![allow(trivial_casts)] // for ARM
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -91,7 +91,7 @@ pub struct FileFilter {
|
|||||||
impl FileFilter {
|
impl FileFilter {
|
||||||
/// Remove every file in the given vector that does *not* pass the
|
/// Remove every file in the given vector that does *not* pass the
|
||||||
/// filter predicate for files found inside a directory.
|
/// filter predicate for files found inside a directory.
|
||||||
pub fn filter_child_files(&self, files: &mut Vec<File>) {
|
pub fn filter_child_files(&self, files: &mut Vec<File<'_>>) {
|
||||||
files.retain(|f| ! self.ignore_patterns.is_ignored(&f.name));
|
files.retain(|f| ! self.ignore_patterns.is_ignored(&f.name));
|
||||||
|
|
||||||
if self.only_dirs {
|
if self.only_dirs {
|
||||||
@ -108,7 +108,7 @@ impl FileFilter {
|
|||||||
/// dotfile, because it’s been directly specified. But running
|
/// dotfile, because it’s been directly specified. But running
|
||||||
/// `exa -I='*.ogg' music/*` should filter out the ogg files obtained
|
/// `exa -I='*.ogg' music/*` should filter out the ogg files obtained
|
||||||
/// from the glob, even though the globbing is done by the shell!
|
/// from the glob, even though the globbing is done by the shell!
|
||||||
pub fn filter_argument_files(&self, files: &mut Vec<File>) {
|
pub fn filter_argument_files(&self, files: &mut Vec<File<'_>>) {
|
||||||
files.retain(|f| {
|
files.retain(|f| {
|
||||||
! self.ignore_patterns.is_ignored(&f.name)
|
! self.ignore_patterns.is_ignored(&f.name)
|
||||||
});
|
});
|
||||||
@ -240,7 +240,7 @@ impl SortField {
|
|||||||
/// into groups between letters and numbers, and then sorts those blocks
|
/// into groups between letters and numbers, and then sorts those blocks
|
||||||
/// together, so `file10` will sort after `file9`, instead of before it
|
/// together, so `file10` will sort after `file9`, instead of before it
|
||||||
/// because of the `1`.
|
/// because of the `1`.
|
||||||
pub fn compare_files(self, a: &File, b: &File) -> Ordering {
|
pub fn compare_files(self, a: &File<'_>, b: &File<'_>) -> Ordering {
|
||||||
use self::SortCase::{ABCabc, AaBbCc};
|
use self::SortCase::{ABCabc, AaBbCc};
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
|
@ -19,7 +19,7 @@ impl FileExtensions {
|
|||||||
/// An “immediate” file is something that can be run or activated somehow
|
/// An “immediate” file is something that can be run or activated somehow
|
||||||
/// in order to kick off the build of a project. It’s usually only present
|
/// in order to kick off the build of a project. It’s usually only present
|
||||||
/// in directories full of source code.
|
/// in directories full of source code.
|
||||||
fn is_immediate(&self, file: &File) -> bool {
|
fn is_immediate(&self, file: &File<'_>) -> bool {
|
||||||
file.name.to_lowercase().starts_with("readme") ||
|
file.name.to_lowercase().starts_with("readme") ||
|
||||||
file.name.ends_with(".ninja") ||
|
file.name.ends_with(".ninja") ||
|
||||||
file.name_is_one_of( &[
|
file.name_is_one_of( &[
|
||||||
@ -30,7 +30,7 @@ impl FileExtensions {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_image(&self, file: &File) -> bool {
|
fn is_image(&self, file: &File<'_>) -> bool {
|
||||||
file.extension_is_one_of( &[
|
file.extension_is_one_of( &[
|
||||||
"png", "jpeg", "jpg", "gif", "bmp", "tiff", "tif",
|
"png", "jpeg", "jpg", "gif", "bmp", "tiff", "tif",
|
||||||
"ppm", "pgm", "pbm", "pnm", "webp", "raw", "arw",
|
"ppm", "pgm", "pbm", "pnm", "webp", "raw", "arw",
|
||||||
@ -39,33 +39,33 @@ impl FileExtensions {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_video(&self, file: &File) -> bool {
|
fn is_video(&self, file: &File<'_>) -> bool {
|
||||||
file.extension_is_one_of( &[
|
file.extension_is_one_of( &[
|
||||||
"avi", "flv", "m2v", "m4v", "mkv", "mov", "mp4", "mpeg",
|
"avi", "flv", "m2v", "m4v", "mkv", "mov", "mp4", "mpeg",
|
||||||
"mpg", "ogm", "ogv", "vob", "wmv", "webm", "m2ts",
|
"mpg", "ogm", "ogv", "vob", "wmv", "webm", "m2ts",
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_music(&self, file: &File) -> bool {
|
fn is_music(&self, file: &File<'_>) -> bool {
|
||||||
file.extension_is_one_of( &[
|
file.extension_is_one_of( &[
|
||||||
"aac", "m4a", "mp3", "ogg", "wma", "mka", "opus",
|
"aac", "m4a", "mp3", "ogg", "wma", "mka", "opus",
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lossless music, rather than any other kind of data...
|
// Lossless music, rather than any other kind of data...
|
||||||
fn is_lossless(&self, file: &File) -> bool {
|
fn is_lossless(&self, file: &File<'_>) -> bool {
|
||||||
file.extension_is_one_of( &[
|
file.extension_is_one_of( &[
|
||||||
"alac", "ape", "flac", "wav",
|
"alac", "ape", "flac", "wav",
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_crypto(&self, file: &File) -> bool {
|
fn is_crypto(&self, file: &File<'_>) -> bool {
|
||||||
file.extension_is_one_of( &[
|
file.extension_is_one_of( &[
|
||||||
"asc", "enc", "gpg", "pgp", "sig", "signature", "pfx", "p12",
|
"asc", "enc", "gpg", "pgp", "sig", "signature", "pfx", "p12",
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_document(&self, file: &File) -> bool {
|
fn is_document(&self, file: &File<'_>) -> bool {
|
||||||
file.extension_is_one_of( &[
|
file.extension_is_one_of( &[
|
||||||
"djvu", "doc", "docx", "dvi", "eml", "eps", "fotd", "key",
|
"djvu", "doc", "docx", "dvi", "eml", "eps", "fotd", "key",
|
||||||
"keynote", "numbers", "odp", "odt", "pages", "pdf", "ppt",
|
"keynote", "numbers", "odp", "odt", "pages", "pdf", "ppt",
|
||||||
@ -73,7 +73,7 @@ impl FileExtensions {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_compressed(&self, file: &File) -> bool {
|
fn is_compressed(&self, file: &File<'_>) -> bool {
|
||||||
file.extension_is_one_of( &[
|
file.extension_is_one_of( &[
|
||||||
"zip", "tar", "Z", "z", "gz", "bz2", "a", "ar", "7z",
|
"zip", "tar", "Z", "z", "gz", "bz2", "a", "ar", "7z",
|
||||||
"iso", "dmg", "tc", "rar", "par", "tgz", "xz", "txz",
|
"iso", "dmg", "tc", "rar", "par", "tgz", "xz", "txz",
|
||||||
@ -81,13 +81,13 @@ impl FileExtensions {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_temp(&self, file: &File) -> bool {
|
fn is_temp(&self, file: &File<'_>) -> bool {
|
||||||
file.name.ends_with('~')
|
file.name.ends_with('~')
|
||||||
|| (file.name.starts_with('#') && file.name.ends_with('#'))
|
|| (file.name.starts_with('#') && file.name.ends_with('#'))
|
||||||
|| file.extension_is_one_of( &[ "tmp", "swp", "swo", "swn", "bak", "bk" ])
|
|| file.extension_is_one_of( &[ "tmp", "swp", "swo", "swn", "bak", "bk" ])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_compiled(&self, file: &File) -> bool {
|
fn is_compiled(&self, file: &File<'_>) -> bool {
|
||||||
if file.extension_is_one_of( &[ "class", "elc", "hi", "o", "pyc", "zwc", "ko" ]) {
|
if file.extension_is_one_of( &[ "class", "elc", "hi", "o", "pyc", "zwc", "ko" ]) {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ impl FileExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FileColours for FileExtensions {
|
impl FileColours for FileExtensions {
|
||||||
fn colour_file(&self, file: &File) -> Option<Style> {
|
fn colour_file(&self, file: &File<'_>) -> Option<Style> {
|
||||||
use ansi_term::Colour::*;
|
use ansi_term::Colour::*;
|
||||||
|
|
||||||
Some(match file {
|
Some(match file {
|
||||||
@ -121,7 +121,7 @@ impl FileColours for FileExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FileIcon for FileExtensions {
|
impl FileIcon for FileExtensions {
|
||||||
fn icon_file(&self, file: &File) -> Option<char> {
|
fn icon_file(&self, file: &File<'_>) -> Option<char> {
|
||||||
use crate::output::icons::Icons;
|
use crate::output::icons::Icons;
|
||||||
|
|
||||||
if self.is_music(file) || self.is_lossless(file) {
|
if self.is_music(file) || self.is_lossless(file) {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
|
#![warn(deprecated_in_future)]
|
||||||
|
#![warn(future_incompatible)]
|
||||||
|
#![warn(nonstandard_style)]
|
||||||
|
#![warn(rust_2018_compatibility)]
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
#![warn(trivial_casts, trivial_numeric_casts)]
|
#![warn(trivial_casts, trivial_numeric_casts)]
|
||||||
#![warn(unused_results)]
|
#![warn(unused)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
@ -223,7 +228,7 @@ impl<'args> Exa<'args> {
|
|||||||
/// Prints the list of files using whichever view is selected.
|
/// Prints the list of files using whichever view is selected.
|
||||||
/// For various annoying logistical reasons, each one handles
|
/// For various annoying logistical reasons, each one handles
|
||||||
/// printing differently...
|
/// printing differently...
|
||||||
fn print_files(&mut self, dir: Option<&Dir>, files: Vec<File>) -> io::Result<()> {
|
fn print_files(&mut self, dir: Option<&Dir>, files: Vec<File<'_>>) -> io::Result<()> {
|
||||||
if files.is_empty() {
|
if files.is_empty() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ impl DirAction {
|
|||||||
/// There are three possible actions, and they overlap somewhat: the
|
/// There are three possible actions, and they overlap somewhat: the
|
||||||
/// `--tree` flag is another form of recursion, so those two are allowed
|
/// `--tree` flag is another form of recursion, so those two are allowed
|
||||||
/// to both be present, but the `--list-dirs` flag is used separately.
|
/// to both be present, but the `--list-dirs` flag is used separately.
|
||||||
pub fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let recurse = matches.has(&flags::RECURSE)?;
|
let recurse = matches.has(&flags::RECURSE)?;
|
||||||
let as_file = matches.has(&flags::LIST_DIRS)?;
|
let as_file = matches.has(&flags::LIST_DIRS)?;
|
||||||
let tree = matches.has(&flags::TREE)?;
|
let tree = matches.has(&flags::TREE)?;
|
||||||
@ -52,7 +52,7 @@ impl RecurseOptions {
|
|||||||
/// flag’s value, and whether the `--tree` flag was passed, which was
|
/// flag’s value, and whether the `--tree` flag was passed, which was
|
||||||
/// determined earlier. The maximum level should be a number, and this
|
/// determined earlier. The maximum level should be a number, and this
|
||||||
/// will fail with an `Err` if it isn’t.
|
/// will fail with an `Err` if it isn’t.
|
||||||
pub fn deduce(matches: &MatchedFlags, tree: bool) -> Result<Self, OptionsError> {
|
pub fn deduce(matches: &MatchedFlags<'_>, tree: bool) -> Result<Self, OptionsError> {
|
||||||
let max_depth = if let Some(level) = matches.get(&flags::LEVEL)? {
|
let max_depth = if let Some(level) = matches.get(&flags::LEVEL)? {
|
||||||
match level.to_string_lossy().parse() {
|
match level.to_string_lossy().parse() {
|
||||||
Ok(l) => Some(l),
|
Ok(l) => Some(l),
|
||||||
|
@ -50,7 +50,7 @@ impl From<glob::PatternError> for OptionsError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for OptionsError {
|
impl fmt::Display for OptionsError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
use crate::options::parser::TakesValue;
|
use crate::options::parser::TakesValue;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
@ -103,7 +103,7 @@ impl OptionsError {
|
|||||||
pub struct Choices(pub &'static [&'static str]);
|
pub struct Choices(pub &'static [&'static str]);
|
||||||
|
|
||||||
impl fmt::Display for Choices {
|
impl fmt::Display for Choices {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "choices: {}", self.0.join(", "))
|
write!(f, "choices: {}", self.0.join(", "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ use crate::options::parser::MatchedFlags;
|
|||||||
impl FileFilter {
|
impl FileFilter {
|
||||||
|
|
||||||
/// Determines which of all the file filter options to use.
|
/// Determines which of all the file filter options to use.
|
||||||
pub fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
list_dirs_first: matches.has(&flags::DIRS_FIRST)?,
|
list_dirs_first: matches.has(&flags::DIRS_FIRST)?,
|
||||||
reverse: matches.has(&flags::REVERSE)?,
|
reverse: matches.has(&flags::REVERSE)?,
|
||||||
@ -29,7 +29,7 @@ impl SortField {
|
|||||||
/// This argument’s value can be one of several flags, listed above.
|
/// This argument’s value can be one of several flags, listed above.
|
||||||
/// Returns the default sort field if none is given, or `Err` if the
|
/// Returns the default sort field if none is given, or `Err` if the
|
||||||
/// value doesn’t correspond to a sort field we know about.
|
/// value doesn’t correspond to a sort field we know about.
|
||||||
fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let word = match matches.get(&flags::SORT)? {
|
let word = match matches.get(&flags::SORT)? {
|
||||||
Some(w) => w,
|
Some(w) => w,
|
||||||
None => return Ok(Self::default()),
|
None => return Ok(Self::default()),
|
||||||
@ -153,7 +153,7 @@ impl DotFilter {
|
|||||||
/// It also checks for the `--tree` option in strict mode, because of a
|
/// It also checks for the `--tree` option in strict mode, because of a
|
||||||
/// special case where `--tree --all --all` won’t work: listing the
|
/// special case where `--tree --all --all` won’t work: listing the
|
||||||
/// parent directory in tree mode would loop onto itself!
|
/// parent directory in tree mode would loop onto itself!
|
||||||
pub fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let count = matches.count(&flags::ALL);
|
let count = matches.count(&flags::ALL);
|
||||||
|
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
@ -180,7 +180,7 @@ impl IgnorePatterns {
|
|||||||
/// Determines the set of glob patterns to use based on the
|
/// Determines the set of glob patterns to use based on the
|
||||||
/// `--ignore-glob` argument’s value. This is a list of strings
|
/// `--ignore-glob` argument’s value. This is a list of strings
|
||||||
/// separated by pipe (`|`) characters, given in any order.
|
/// separated by pipe (`|`) characters, given in any order.
|
||||||
pub fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
|
|
||||||
// If there are no inputs, we return a set of patterns that doesn’t
|
// If there are no inputs, we return a set of patterns that doesn’t
|
||||||
// match anything, rather than, say, `None`.
|
// match anything, rather than, say, `None`.
|
||||||
@ -204,7 +204,7 @@ impl IgnorePatterns {
|
|||||||
|
|
||||||
|
|
||||||
impl GitIgnore {
|
impl GitIgnore {
|
||||||
pub fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
if matches.has(&flags::GIT_IGNORE)? {
|
if matches.has(&flags::GIT_IGNORE)? {
|
||||||
Ok(Self::CheckAndIgnore)
|
Ok(Self::CheckAndIgnore)
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ impl HelpString {
|
|||||||
/// We don’t do any strict-mode error checking here: it’s OK to give
|
/// We don’t do any strict-mode error checking here: it’s OK to give
|
||||||
/// the --help or --long flags more than once. Actually checking for
|
/// the --help or --long flags more than once. Actually checking for
|
||||||
/// errors when the user wants help is kind of petty!
|
/// errors when the user wants help is kind of petty!
|
||||||
pub fn deduce(matches: &MatchedFlags) -> Option<Self> {
|
pub fn deduce(matches: &MatchedFlags<'_>) -> Option<Self> {
|
||||||
if matches.count(&flags::HELP) > 0 {
|
if matches.count(&flags::HELP) > 0 {
|
||||||
let only_long = matches.count(&flags::LONG) > 0;
|
let only_long = matches.count(&flags::LONG) > 0;
|
||||||
let git = cfg!(feature="git");
|
let git = cfg!(feature="git");
|
||||||
@ -103,7 +103,7 @@ impl fmt::Display for HelpString {
|
|||||||
|
|
||||||
/// Format this help options into an actual string of help
|
/// Format this help options into an actual string of help
|
||||||
/// text to be displayed to the user.
|
/// text to be displayed to the user.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
writeln!(f, "Usage:\n exa [options] [files...]")?;
|
writeln!(f, "Usage:\n exa [options] [files...]")?;
|
||||||
|
|
||||||
if ! self.only_long {
|
if ! self.only_long {
|
||||||
|
@ -167,7 +167,7 @@ impl Options {
|
|||||||
|
|
||||||
/// Determines the complete set of options based on the given command-line
|
/// Determines the complete set of options based on the given command-line
|
||||||
/// arguments, after they’ve been parsed.
|
/// arguments, after they’ve been parsed.
|
||||||
fn deduce<V: Vars>(matches: &MatchedFlags, vars: &V) -> Result<Self, OptionsError> {
|
fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
let dir_action = DirAction::deduce(matches)?;
|
let dir_action = DirAction::deduce(matches)?;
|
||||||
let filter = FileFilter::deduce(matches)?;
|
let filter = FileFilter::deduce(matches)?;
|
||||||
let view = View::deduce(matches, vars)?;
|
let view = View::deduce(matches, vars)?;
|
||||||
@ -214,7 +214,7 @@ pub mod test {
|
|||||||
/// It returns a vector with one or two elements in.
|
/// It returns a vector with one or two elements in.
|
||||||
/// These elements can then be tested with assert_eq or what have you.
|
/// These elements can then be tested with assert_eq or what have you.
|
||||||
pub fn parse_for_test<T, F>(inputs: &[&str], args: &'static [&'static Arg], strictnesses: Strictnesses, get: F) -> Vec<T>
|
pub fn parse_for_test<T, F>(inputs: &[&str], args: &'static [&'static Arg], strictnesses: Strictnesses, get: F) -> Vec<T>
|
||||||
where F: Fn(&MatchedFlags) -> T
|
where F: Fn(&MatchedFlags<'_>) -> T
|
||||||
{
|
{
|
||||||
use self::Strictnesses::*;
|
use self::Strictnesses::*;
|
||||||
use crate::options::parser::{Args, Strictness};
|
use crate::options::parser::{Args, Strictness};
|
||||||
|
@ -68,7 +68,7 @@ impl Flag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Flag {
|
impl fmt::Display for Flag {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
match self {
|
match self {
|
||||||
Self::Short(short) => write!(f, "-{}", *short as char),
|
Self::Short(short) => write!(f, "-{}", *short as char),
|
||||||
Self::Long(long) => write!(f, "--{}", long),
|
Self::Long(long) => write!(f, "--{}", long),
|
||||||
@ -123,7 +123,7 @@ pub struct Arg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Arg {
|
impl fmt::Display for Arg {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
write!(f, "--{}", self.long)?;
|
write!(f, "--{}", self.long)?;
|
||||||
|
|
||||||
if let Some(short) = self.short {
|
if let Some(short) = self.short {
|
||||||
@ -476,7 +476,7 @@ pub enum ParseError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for ParseError {
|
impl fmt::Display for ParseError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::NeedsValue { flag, values: None } => write!(f, "Flag {} needs a value", flag),
|
Self::NeedsValue { flag, values: None } => write!(f, "Flag {} needs a value", flag),
|
||||||
Self::NeedsValue { flag, values: Some(cs) } => write!(f, "Flag {} needs a value ({})", flag, Choices(cs)),
|
Self::NeedsValue { flag, values: Some(cs) } => write!(f, "Flag {} needs a value ({})", flag, Choices(cs)),
|
||||||
|
@ -37,7 +37,7 @@ impl Default for TerminalColours {
|
|||||||
impl TerminalColours {
|
impl TerminalColours {
|
||||||
|
|
||||||
/// Determine which terminal colour conditions to use.
|
/// Determine which terminal colour conditions to use.
|
||||||
fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let word = match matches.get_where(|f| f.matches(&flags::COLOR) || f.matches(&flags::COLOUR))? {
|
let word = match matches.get_where(|f| f.matches(&flags::COLOR) || f.matches(&flags::COLOUR))? {
|
||||||
Some(w) => w,
|
Some(w) => w,
|
||||||
None => return Ok(Self::default()),
|
None => return Ok(Self::default()),
|
||||||
@ -77,7 +77,7 @@ pub struct Styles {
|
|||||||
impl Styles {
|
impl Styles {
|
||||||
|
|
||||||
#[allow(trivial_casts)] // the `as Box<_>` stuff below warns about this for some reason
|
#[allow(trivial_casts)] // the `as Box<_>` stuff below warns about this for some reason
|
||||||
pub fn deduce<V, TW>(matches: &MatchedFlags, vars: &V, widther: TW) -> Result<Self, OptionsError>
|
pub fn deduce<V, TW>(matches: &MatchedFlags<'_>, vars: &V, widther: TW) -> Result<Self, OptionsError>
|
||||||
where TW: Fn() -> Option<usize>, V: Vars {
|
where TW: Fn() -> Option<usize>, V: Vars {
|
||||||
use crate::info::filetype::FileExtensions;
|
use crate::info::filetype::FileExtensions;
|
||||||
use crate::output::file_name::NoFileColours;
|
use crate::output::file_name::NoFileColours;
|
||||||
@ -185,7 +185,7 @@ struct ExtensionMappings {
|
|||||||
|
|
||||||
use crate::output::file_name::FileColours;
|
use crate::output::file_name::FileColours;
|
||||||
impl FileColours for ExtensionMappings {
|
impl FileColours for ExtensionMappings {
|
||||||
fn colour_file(&self, file: &File) -> Option<Style> {
|
fn colour_file(&self, file: &File<'_>) -> Option<Style> {
|
||||||
self.mappings.iter().rev()
|
self.mappings.iter().rev()
|
||||||
.find(|t| t.0.matches(&file.name))
|
.find(|t| t.0.matches(&file.name))
|
||||||
.map (|t| t.1)
|
.map (|t| t.1)
|
||||||
@ -204,7 +204,7 @@ impl ExtensionMappings {
|
|||||||
|
|
||||||
|
|
||||||
impl Classify {
|
impl Classify {
|
||||||
fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let flagged = matches.has(&flags::CLASSIFY)?;
|
let flagged = matches.has(&flags::CLASSIFY)?;
|
||||||
|
|
||||||
if flagged { Ok(Self::AddFileIndicators) }
|
if flagged { Ok(Self::AddFileIndicators) }
|
||||||
|
@ -19,7 +19,7 @@ impl VersionString {
|
|||||||
/// ‘deduce’ functions, returning Err if help needs to be shown.
|
/// ‘deduce’ functions, returning Err if help needs to be shown.
|
||||||
///
|
///
|
||||||
/// Like --help, this doesn’t check for errors.
|
/// Like --help, this doesn’t check for errors.
|
||||||
pub fn deduce(matches: &MatchedFlags) -> Option<Self> {
|
pub fn deduce(matches: &MatchedFlags<'_>) -> Option<Self> {
|
||||||
if matches.count(&flags::VERSION) > 0 {
|
if matches.count(&flags::VERSION) > 0 {
|
||||||
Some(Self)
|
Some(Self)
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ impl VersionString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for VersionString {
|
impl fmt::Display for VersionString {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
write!(f, "{}", include!(concat!(env!("OUT_DIR"), "/version_string.txt")))
|
write!(f, "{}", include!(concat!(env!("OUT_DIR"), "/version_string.txt")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ use crate::output::time::TimeFormat;
|
|||||||
impl View {
|
impl View {
|
||||||
|
|
||||||
/// Determine which view to use and all of that view’s arguments.
|
/// Determine which view to use and all of that view’s arguments.
|
||||||
pub fn deduce<V: Vars>(matches: &MatchedFlags, vars: &V) -> Result<Self, OptionsError> {
|
pub fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
use crate::options::style::Styles;
|
use crate::options::style::Styles;
|
||||||
|
|
||||||
let mode = Mode::deduce(matches, vars)?;
|
let mode = Mode::deduce(matches, vars)?;
|
||||||
@ -25,7 +25,7 @@ impl View {
|
|||||||
impl Mode {
|
impl Mode {
|
||||||
|
|
||||||
/// Determine the mode from the command-line arguments.
|
/// Determine the mode from the command-line arguments.
|
||||||
pub fn deduce<V: Vars>(matches: &MatchedFlags, vars: &V) -> Result<Self, OptionsError> {
|
pub fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
let long = || {
|
let long = || {
|
||||||
if matches.has(&flags::ACROSS)? && ! matches.has(&flags::GRID)? {
|
if matches.has(&flags::ACROSS)? && ! matches.has(&flags::GRID)? {
|
||||||
Err(OptionsError::Useless(&flags::ACROSS, true, &flags::LONG))
|
Err(OptionsError::Useless(&flags::ACROSS, true, &flags::LONG))
|
||||||
@ -207,7 +207,7 @@ impl RowThreshold {
|
|||||||
|
|
||||||
|
|
||||||
impl TableOptions {
|
impl TableOptions {
|
||||||
fn deduce<V: Vars>(matches: &MatchedFlags, vars: &V) -> Result<Self, OptionsError> {
|
fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
let time_format = TimeFormat::deduce(matches, vars)?;
|
let time_format = TimeFormat::deduce(matches, vars)?;
|
||||||
let size_format = SizeFormat::deduce(matches)?;
|
let size_format = SizeFormat::deduce(matches)?;
|
||||||
let columns = Columns::deduce(matches)?;
|
let columns = Columns::deduce(matches)?;
|
||||||
@ -217,7 +217,7 @@ impl TableOptions {
|
|||||||
|
|
||||||
|
|
||||||
impl Columns {
|
impl Columns {
|
||||||
fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let time_types = TimeTypes::deduce(matches)?;
|
let time_types = TimeTypes::deduce(matches)?;
|
||||||
let git = cfg!(feature = "git") && matches.has(&flags::GIT)?;
|
let git = cfg!(feature = "git") && matches.has(&flags::GIT)?;
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ impl SizeFormat {
|
|||||||
/// strings of digits in your head. Changing the format to anything else
|
/// strings of digits in your head. Changing the format to anything else
|
||||||
/// involves the `--binary` or `--bytes` flags, and these conflict with
|
/// involves the `--binary` or `--bytes` flags, and these conflict with
|
||||||
/// each other.
|
/// each other.
|
||||||
fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let flag = matches.has_where(|f| f.matches(&flags::BINARY) || f.matches(&flags::BYTES))?;
|
let flag = matches.has_where(|f| f.matches(&flags::BINARY) || f.matches(&flags::BYTES))?;
|
||||||
|
|
||||||
Ok(match flag {
|
Ok(match flag {
|
||||||
@ -261,7 +261,7 @@ impl SizeFormat {
|
|||||||
impl TimeFormat {
|
impl TimeFormat {
|
||||||
|
|
||||||
/// Determine how time should be formatted in timestamp columns.
|
/// Determine how time should be formatted in timestamp columns.
|
||||||
fn deduce<V: Vars>(matches: &MatchedFlags, vars: &V) -> Result<Self, OptionsError> {
|
fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
let word = match matches.get(&flags::TIME_STYLE)? {
|
let word = match matches.get(&flags::TIME_STYLE)? {
|
||||||
Some(w) => {
|
Some(w) => {
|
||||||
w.to_os_string()
|
w.to_os_string()
|
||||||
@ -306,7 +306,7 @@ impl TimeTypes {
|
|||||||
/// It’s valid to show more than one column by passing in more than one
|
/// It’s valid to show more than one column by passing in more than one
|
||||||
/// option, but passing *no* options means that the user just wants to
|
/// option, but passing *no* options means that the user just wants to
|
||||||
/// see the default set.
|
/// see the default set.
|
||||||
fn deduce(matches: &MatchedFlags) -> Result<Self, OptionsError> {
|
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let possible_word = matches.get(&flags::TIME)?;
|
let possible_word = matches.get(&flags::TIME)?;
|
||||||
let modified = matches.has(&flags::MODIFIED)?;
|
let modified = matches.has(&flags::MODIFIED)?;
|
||||||
let changed = matches.has(&flags::CHANGED)?;
|
let changed = matches.has(&flags::CHANGED)?;
|
||||||
|
@ -157,7 +157,7 @@ impl TextCellContents {
|
|||||||
|
|
||||||
/// Produces an `ANSIStrings` value that can be used to print the styled
|
/// Produces an `ANSIStrings` value that can be used to print the styled
|
||||||
/// values of this cell as an ANSI-terminal-formatted string.
|
/// values of this cell as an ANSI-terminal-formatted string.
|
||||||
pub fn strings(&self) -> ANSIStrings {
|
pub fn strings(&self) -> ANSIStrings<'_> {
|
||||||
ANSIStrings(&self.0)
|
ANSIStrings(&self.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ impl<'a> Render<'a> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// this is safe because all entries have been initialized above
|
// this is safe because all entries have been initialized above
|
||||||
let mut file_eggs = unsafe { std::mem::transmute::<_, Vec<Egg>>(file_eggs) };
|
let mut file_eggs = unsafe { std::mem::transmute::<_, Vec<Egg<'_>>>(file_eggs) };
|
||||||
self.filter.sort_files(&mut file_eggs);
|
self.filter.sort_files(&mut file_eggs);
|
||||||
|
|
||||||
for (tree_params, egg) in depth.iterate_over(file_eggs.into_iter()) {
|
for (tree_params, egg) in depth.iterate_over(file_eggs.into_iter()) {
|
||||||
|
@ -76,7 +76,7 @@ impl Default for Classify {
|
|||||||
|
|
||||||
/// A **file name** holds all the information necessary to display the name
|
/// A **file name** holds all the information necessary to display the name
|
||||||
/// of the given file. This is used in all of the views.
|
/// of the given file. This is used in all of the views.
|
||||||
pub struct FileName<'a, 'dir: 'a, C: Colours+'a> {
|
pub struct FileName<'a, 'dir, C: Colours> {
|
||||||
|
|
||||||
/// A reference to the file that we’re getting the name of.
|
/// A reference to the file that we’re getting the name of.
|
||||||
file: &'a File<'dir>,
|
file: &'a File<'dir>,
|
||||||
@ -191,7 +191,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|||||||
|
|
||||||
/// Adds the bits of the parent path to the given bits vector.
|
/// Adds the bits of the parent path to the given bits vector.
|
||||||
/// The path gets its characters escaped based on the colours.
|
/// The path gets its characters escaped based on the colours.
|
||||||
fn add_parent_bits(&self, bits: &mut Vec<ANSIString>, parent: &Path) {
|
fn add_parent_bits(&self, bits: &mut Vec<ANSIString<'_>>, parent: &Path) {
|
||||||
let coconut = parent.components().count();
|
let coconut = parent.components().count();
|
||||||
|
|
||||||
if coconut == 1 && parent.has_root() {
|
if coconut == 1 && parent.has_root() {
|
||||||
@ -324,14 +324,14 @@ pub trait Colours: FiletypeColours {
|
|||||||
|
|
||||||
// needs Debug because FileStyle derives it
|
// needs Debug because FileStyle derives it
|
||||||
pub trait FileColours: Debug + Sync {
|
pub trait FileColours: Debug + Sync {
|
||||||
fn colour_file(&self, file: &File) -> Option<Style>;
|
fn colour_file(&self, file: &File<'_>) -> Option<Style>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
pub struct NoFileColours;
|
pub struct NoFileColours;
|
||||||
impl FileColours for NoFileColours {
|
impl FileColours for NoFileColours {
|
||||||
fn colour_file(&self, _file: &File) -> Option<Style> {
|
fn colour_file(&self, _file: &File<'_>) -> Option<Style> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ impl<A, B> FileColours for (A, B)
|
|||||||
where A: FileColours,
|
where A: FileColours,
|
||||||
B: FileColours,
|
B: FileColours,
|
||||||
{
|
{
|
||||||
fn colour_file(&self, file: &File) -> Option<Style> {
|
fn colour_file(&self, file: &File<'_>) -> Option<Style> {
|
||||||
self.0.colour_file(file)
|
self.0.colour_file(file)
|
||||||
.or_else(|| self.1.colour_file(file))
|
.or_else(|| self.1.colour_file(file))
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ impl<'a> Render<'a> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_table(&mut self, options: &'a TableOptions, drender: &DetailsRender) -> (Table<'a>, Vec<DetailsRow>) {
|
fn make_table(&mut self, options: &'a TableOptions, drender: &DetailsRender<'_>) -> (Table<'a>, Vec<DetailsRow>) {
|
||||||
match (self.git, self.dir) {
|
match (self.git, self.dir) {
|
||||||
(Some(g), Some(d)) => if ! g.has_anything_for(&d.path) { self.git = None },
|
(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 },
|
(Some(g), None) => if ! self.files.iter().any(|f| g.has_anything_for(&f.path)) { self.git = None },
|
||||||
@ -209,7 +209,7 @@ impl<'a> Render<'a> {
|
|||||||
(table, rows)
|
(table, rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_grid(&mut self, column_count: usize, options: &'a TableOptions, file_names: &[TextCell], rows: Vec<TableRow>, drender: &DetailsRender) -> grid::Grid {
|
fn make_grid(&mut self, column_count: usize, options: &'a TableOptions, file_names: &[TextCell], rows: Vec<TableRow>, drender: &DetailsRender<'_>) -> grid::Grid {
|
||||||
let mut tables = Vec::new();
|
let mut tables = Vec::new();
|
||||||
for _ in 0 .. column_count {
|
for _ in 0 .. column_count {
|
||||||
tables.push(self.make_table(options, drender));
|
tables.push(self.make_table(options, drender));
|
||||||
@ -294,7 +294,7 @@ fn divide_rounding_up(a: usize, b: usize) -> usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn file_has_xattrs(file: &File) -> bool {
|
fn file_has_xattrs(file: &File<'_>) -> bool {
|
||||||
match file.path.attributes() {
|
match file.path.attributes() {
|
||||||
Ok(attrs) => ! attrs.is_empty(),
|
Ok(attrs) => ! attrs.is_empty(),
|
||||||
Err(_) => false,
|
Err(_) => false,
|
||||||
|
@ -6,7 +6,7 @@ use crate::output::file_name::FileStyle;
|
|||||||
|
|
||||||
|
|
||||||
pub trait FileIcon {
|
pub trait FileIcon {
|
||||||
fn icon_file(&self, file: &File) -> Option<char>;
|
fn icon_file(&self, file: &File<'_>) -> Option<char>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ impl Icons {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn painted_icon(file: &File, style: &FileStyle) -> String {
|
pub fn painted_icon(file: &File<'_>, style: &FileStyle) -> String {
|
||||||
let file_icon = icon(file).to_string();
|
let file_icon = icon(file).to_string();
|
||||||
let painted = style.exts
|
let painted = style.exts
|
||||||
.colour_file(file)
|
.colour_file(file)
|
||||||
@ -53,7 +53,7 @@ pub fn painted_icon(file: &File, style: &FileStyle) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn icon(file: &File) -> char {
|
fn icon(file: &File<'_>) -> char {
|
||||||
let extensions = Box::new(FileExtensions);
|
let extensions = Box::new(FileExtensions);
|
||||||
|
|
||||||
if file.points_to_directory() {
|
if file.points_to_directory() {
|
||||||
|
@ -265,7 +265,7 @@ pub struct Environment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Environment {
|
impl Environment {
|
||||||
pub fn lock_users(&self) -> MutexGuard<UsersCache> {
|
pub fn lock_users(&self) -> MutexGuard<'_, UsersCache> {
|
||||||
self.users.lock().unwrap()
|
self.users.lock().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ impl<'a, 'f> Table<'a> {
|
|||||||
Row { cells }
|
Row { cells }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn row_for_file(&self, file: &File, xattrs: bool) -> Row {
|
pub fn row_for_file(&self, file: &File<'_>, xattrs: bool) -> Row {
|
||||||
let cells = self.columns.iter()
|
let cells = self.columns.iter()
|
||||||
.map(|c| self.display(file, *c, xattrs))
|
.map(|c| self.display(file, *c, xattrs))
|
||||||
.collect();
|
.collect();
|
||||||
@ -359,7 +359,7 @@ impl<'a, 'f> Table<'a> {
|
|||||||
self.widths.add_widths(row)
|
self.widths.add_widths(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn permissions_plus(&self, file: &File, xattrs: bool) -> f::PermissionsPlus {
|
fn permissions_plus(&self, file: &File<'_>, xattrs: bool) -> f::PermissionsPlus {
|
||||||
f::PermissionsPlus {
|
f::PermissionsPlus {
|
||||||
file_type: file.type_char(),
|
file_type: file.type_char(),
|
||||||
permissions: file.permissions(),
|
permissions: file.permissions(),
|
||||||
@ -367,13 +367,13 @@ impl<'a, 'f> Table<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn octal_permissions(&self, file: &File) -> f::OctalPermissions {
|
fn octal_permissions(&self, file: &File<'_>) -> f::OctalPermissions {
|
||||||
f::OctalPermissions {
|
f::OctalPermissions {
|
||||||
permissions: file.permissions(),
|
permissions: file.permissions(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display(&self, file: &File, column: Column, xattrs: bool) -> TextCell {
|
fn display(&self, file: &File<'_>, column: Column, xattrs: bool) -> TextCell {
|
||||||
match column {
|
match column {
|
||||||
Column::Permissions => {
|
Column::Permissions => {
|
||||||
self.permissions_plus(file, xattrs).render(self.colours)
|
self.permissions_plus(file, xattrs).render(self.colours)
|
||||||
@ -418,7 +418,7 @@ impl<'a, 'f> Table<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn git_status(&self, file: &File) -> f::Git {
|
fn git_status(&self, file: &File<'_>) -> f::Git {
|
||||||
debug!("Getting Git status for file {:?}", file.path);
|
debug!("Getting Git status for file {:?}", file.path);
|
||||||
|
|
||||||
self.git
|
self.git
|
||||||
|
@ -25,7 +25,7 @@ use unicode_width::UnicodeWidthStr;
|
|||||||
///
|
///
|
||||||
/// Currently exa does not support *custom* styles, where the user enters a
|
/// Currently exa does not support *custom* styles, where the user enters a
|
||||||
/// format string in an environment variable or something. Just these four.
|
/// format string in an environment variable or something. Just these four.
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug, Copy, Clone)]
|
||||||
pub enum TimeFormat {
|
pub enum TimeFormat {
|
||||||
|
|
||||||
/// The **default format** uses the user’s locale to print month names,
|
/// The **default format** uses the user’s locale to print month names,
|
||||||
|
@ -268,7 +268,7 @@ impl Colours {
|
|||||||
/// Sets a value on this set of colours using one of the keys understood
|
/// Sets a value on this set of colours using one of the keys understood
|
||||||
/// by the `LS_COLORS` environment variable. Invalid keys set nothing, but
|
/// by the `LS_COLORS` environment variable. Invalid keys set nothing, but
|
||||||
/// return false.
|
/// return false.
|
||||||
pub fn set_ls(&mut self, pair: &Pair) -> bool {
|
pub fn set_ls(&mut self, pair: &Pair<'_>) -> bool {
|
||||||
match pair.key {
|
match pair.key {
|
||||||
"di" => self.filekinds.directory = pair.to_style(), // DIR
|
"di" => self.filekinds.directory = pair.to_style(), // DIR
|
||||||
"ex" => self.filekinds.executable = pair.to_style(), // EXEC
|
"ex" => self.filekinds.executable = pair.to_style(), // EXEC
|
||||||
@ -291,7 +291,7 @@ impl Colours {
|
|||||||
/// by the `EXA_COLORS` environment variable. Invalid keys set nothing,
|
/// by the `EXA_COLORS` environment variable. Invalid keys set nothing,
|
||||||
/// but return false. This doesn’t take the `LS_COLORS` keys into account,
|
/// but return false. This doesn’t take the `LS_COLORS` keys into account,
|
||||||
/// so `set_ls` should have been run first.
|
/// so `set_ls` should have been run first.
|
||||||
pub fn set_exa(&mut self, pair: &Pair) -> bool {
|
pub fn set_exa(&mut self, pair: &Pair<'_>) -> bool {
|
||||||
match pair.key {
|
match pair.key {
|
||||||
"ur" => self.perms.user_read = pair.to_style(),
|
"ur" => self.perms.user_read = pair.to_style(),
|
||||||
"uw" => self.perms.user_write = pair.to_style(),
|
"uw" => self.perms.user_write = pair.to_style(),
|
||||||
|
Loading…
Reference in New Issue
Block a user