Skip to content
Myr

Remove 'internal' module

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 342d12d · Browse files · 4 files+20 added−22 removed
This commit

State

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

Diff stats

4 files+20 added−22 removed

  • other:+20 added−22 removed

4 files+20 added−22 removed

modified:src/fshelper/mod.rs+18 added
1use std::borrow::Cow;2use std::env::current_dir;3use std::ffi::OsStr;4use std::fs;5use std::io;6#[cfg(any(unix, target_os = "redox"))]7use std::os::unix::fs::PermissionsExt;
57 unmodified lines
65 } else {66 false67 }68}6970#[cfg(any(unix, target_os = "redox"))]71pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> {72 use std::os::unix::ffi::OsStrExt;73 Cow::Borrowed(input.as_bytes())74}7576#[cfg(windows)]77pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> {78 let string = input.to_string_lossy();7980 match string {81 Cow::Owned(string) => Cow::Owned(string.into_bytes()),82 Cow::Borrowed(string) => Cow::Borrowed(string.as_bytes()),83 }84}
deleted:src/internal/mod.rs-18 removed
1use std::borrow::Cow;2use std::ffi::OsStr;34#[cfg(any(unix, target_os = "redox"))]5pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> {6 use std::os::unix::ffi::OsStrExt;7 Cow::Borrowed(input.as_bytes())8}910#[cfg(windows)]11pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> {12 let string = input.to_string_lossy();1314 match string {15 Cow::Owned(string) => Cow::Owned(string.into_bytes()),16 Cow::Borrowed(string) => Cow::Borrowed(string.as_bytes()),17 }18}
modified:src/main.rs-1 removed
5 unmodified lines
6mod exit_codes;7mod filetypes;8mod filter;9mod fshelper;10mod internal;10mod options;11mod output;12mod regex_helper;13mod walk;
305 unmodified lines
modified:src/walk.rs+2 added-3 removed
1use crate::exec;2use crate::exit_codes::{merge_exitcodes, ExitCode};3use crate::fshelper;4use crate::internal::osstr_to_bytes;4use crate::options::Options;5use crate::output;67use std::borrow::Cow;
352 unmodified lines
360 ),361 }362 };363365 if !pattern.is_match(&osstr_to_bytes(search_str.as_ref())) {364 if !pattern.is_match(&fshelper::osstr_to_bytes(search_str.as_ref())) {365 return ignore::WalkState::Continue;366 }367368 // Filter out unwanted extensions.369 if let Some(ref exts_regex) = config.extensions {370 if let Some(path_str) = entry_path.file_name() {372 if !exts_regex.is_match(&osstr_to_bytes(path_str)) {371 if !exts_regex.is_match(&fshelper::osstr_to_bytes(path_str)) {372 return ignore::WalkState::Continue;373 }374 } else {375 return ignore::WalkState::Continue;
70 unmodified lines