Skip to content
Myr

Update for new rustfmt

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by David Peter · parent 9628d7f · Browse files · 7 files+22 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+22 added−13 removed

  • tests:+4 added−2 removed
  • other:+18 added−11 removed

7 files+22 added−13 removed

modified:src/app.rs+2 added-2 removed
13 unmodified lines
14 long: &'static str,15}1617macro_rules! doc {18 ($map: expr, $name: expr, $short: expr) => {18 ($map:expr, $name:expr, $short:expr) => {19 doc!($map, $name, $short, $short)20 };21 ($map: expr, $name: expr, $short: expr, $long: expr) => {21 ($map:expr, $name:expr, $short:expr, $long:expr) => {22 $map.insert(23 $name,24 Help {25 short: $short,
258 unmodified lines
modified:src/main.rs+7 added-4 removed
35 unmodified lines
36use atty::Stream;37use regex::{RegexBuilder, RegexSetBuilder};3839use exec::CommandTemplate;40use internal::{error, pattern_has_uppercase_char, transform_args_with_exec, FdOptions, FileTypes,41 SizeFilter};40use internal::{41 error, pattern_has_uppercase_char, transform_args_with_exec, FdOptions, FileTypes, SizeFilter,42};43use lscolors::LsColors;4445fn main() {46 let checked_args = transform_args_with_exec(env::args_os());
37 unmodified lines
84 .collect();85 }8687 // Detect if the user accidentally supplied a path instead of a search pattern87 if !matches.is_present("full-path") && pattern.contains(std::path::MAIN_SEPARATOR)88 if !matches.is_present("full-path")89 && pattern.contains(std::path::MAIN_SEPARATOR)90 && fshelper::is_dir(Path::new(pattern))91 {92 error(&format!(93 "Error: The search pattern '{pattern}' contains a path-separation character ('{sep}') \
96 unmodified lines
190 }191 file_types192 }),193 extensions: matches.values_of("extension").map(|exts| {192 let patterns = exts.map(|e| e.trim_left_matches('.'))194 let patterns = exts195 .map(|e| e.trim_left_matches('.'))196 .map(|e| format!(r".\.{}$", regex::escape(e)));197 match RegexSetBuilder::new(patterns)198 .case_insensitive(true)199 .build()
32 unmodified lines
modified:src/output.rs+6 added-3 removed
103 unmodified lines
104 write!(&mut io::stdout(), "{}{}", path_str, separator)105}106107fn get_path_style<'a>(path: &Path, ls_colors: &'a LsColors) -> Option<&'a ansi_term::Style> {108 if path108 if path.symlink_metadata()109 .symlink_metadata()110 .map(|md| md.file_type().is_symlink())111 .unwrap_or(false)112 {113 return Some(&ls_colors.symlink);
4 unmodified lines
118 if metadata.as_ref().map(|md| md.is_dir()).unwrap_or(false) {119 Some(&ls_colors.directory)120 } else if metadata.map(|md| is_executable(&md)).unwrap_or(false) {121 Some(&ls_colors.executable)121 } else if let Some(filename_style) = path.file_name()122 } else if let Some(filename_style) = path123 .file_name()124 .and_then(|n| n.to_str())125 .and_then(|n| ls_colors.filenames.get(n))126 {127 Some(filename_style)126 } else if let Some(extension_style) = path.extension()128 } else if let Some(extension_style) = path129 .extension()130 .and_then(|e| e.to_str())131 .and_then(|e| ls_colors.extensions.get(e))132 {133 Some(extension_style)
4 unmodified lines
modified:src/walk.rs+2 added-1 removed
222 unmodified lines
223 && !fshelper::is_executable(&entry.metadata().unwrap())224 && file_types.executables_only)225 {226 return ignore::WalkState::Continue;227 } else if !(entry_type.is_file() || entry_type.is_dir()227 } else if !(entry_type.is_file()228 || entry_type.is_dir()229 || entry_type.is_symlink())230 {231 // This is probably a block device, char device, fifo or socket. Skip it.232 return ignore::WalkState::Continue;
70 unmodified lines
modified:tests/testenv/mod.rs+2 added-1 removed
118 unmodified lines
119120/// Normalize the output for comparison.121fn normalize_output(s: &str, trim_left: bool) -> String {122 // Split into lines and normalize separators.123 let mut lines = s.replace('\0', "NULL\n")123 let mut lines = s124 .replace('\0', "NULL\n")125 .lines()126 .map(|line| {127 let line =128 if trim_left { line.trim_left() } else { line };
67 unmodified lines
modified:tests/tests.rs+2 added-1 removed
31 unmodified lines
32 "e1 e2",33];3435fn get_absolute_root_path(env: &TestEnv) -> String {36 let path = env.test_root()36 let path = env37 .test_root()38 .canonicalize()39 .expect("absolute path")40 .to_str()41 .expect("string")
1043 unmodified lines
modified:.travis.yml+1 added-1 removed