mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 15:07:47 +00:00
refactor/polish ~ fix cargo clippy
complaints (String => str)
This commit is contained in:
parent
3bddf84aec
commit
98039f176d
3 changed files with 5 additions and 5 deletions
|
@ -229,7 +229,7 @@ fn check_default(path: &[String]) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether a path is or if other problems arise
|
// check whether a path is or if other problems arise
|
||||||
fn check_searchable(path: &String) -> bool {
|
fn check_searchable(path: &str) -> bool {
|
||||||
// we use lstat, just like the original implementation
|
// we use lstat, just like the original implementation
|
||||||
match fs::symlink_metadata(path) {
|
match fs::symlink_metadata(path) {
|
||||||
Ok(_) => true,
|
Ok(_) => true,
|
||||||
|
@ -243,12 +243,12 @@ fn check_searchable(path: &String) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for a hyphen at the beginning of a path segment
|
// check for a hyphen at the beginning of a path segment
|
||||||
fn no_leading_hyphen(path_segment: &String) -> bool {
|
fn no_leading_hyphen(path_segment: &str) -> bool {
|
||||||
!path_segment.starts_with('-')
|
!path_segment.starts_with('-')
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether a path segment contains only valid (read: portable) characters
|
// check whether a path segment contains only valid (read: portable) characters
|
||||||
fn check_portable_chars(path_segment: &String) -> bool {
|
fn check_portable_chars(path_segment: &str) -> bool {
|
||||||
let valid_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-".to_string();
|
let valid_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-".to_string();
|
||||||
for ch in path_segment.chars() {
|
for ch in path_segment.chars() {
|
||||||
if !valid_str.contains(ch) {
|
if !valid_str.contains(ch) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn warn_excess_args(first_arg: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Memo {
|
impl Memo {
|
||||||
pub fn new(pf_string: &String, pf_args_it: &mut Peekable<Iter<String>>) -> Memo {
|
pub fn new(pf_string: &str, pf_args_it: &mut Peekable<Iter<String>>) -> Memo {
|
||||||
let mut pm = Memo { tokens: Vec::new() };
|
let mut pm = Memo { tokens: Vec::new() };
|
||||||
let mut tmp_token: Option<Box<dyn Token>>;
|
let mut tmp_token: Option<Box<dyn Token>>;
|
||||||
let mut it = put_back_n(pf_string.chars());
|
let mut it = put_back_n(pf_string.chars());
|
||||||
|
|
|
@ -11,7 +11,7 @@ use super::formatters::cninetyninehexfloatf::CninetyNineHexFloatf;
|
||||||
use super::formatters::scif::Scif;
|
use super::formatters::scif::Scif;
|
||||||
use super::formatters::decf::Decf;
|
use super::formatters::decf::Decf;
|
||||||
|
|
||||||
pub fn warn_expected_numeric(pf_arg: &String) {
|
pub fn warn_expected_numeric(pf_arg: &str) {
|
||||||
// important: keep println here not print
|
// important: keep println here not print
|
||||||
cli::err_msg(&format!("{}: expected a numeric value", pf_arg));
|
cli::err_msg(&format!("{}: expected a numeric value", pf_arg));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue