mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
feat: minor linting
This commit is contained in:
parent
8040305715
commit
249ef537fe
9 changed files with 11 additions and 19 deletions
|
@ -47,10 +47,7 @@ impl SplitName {
|
|||
.transpose()?
|
||||
.unwrap_or(2);
|
||||
|
||||
let format_string = match format_opt {
|
||||
Some(f) => f,
|
||||
None => format!("%0{n_digits}u"),
|
||||
};
|
||||
let format_string = format_opt.unwrap_or_else(|| format!("%0{n_digits}u"));
|
||||
|
||||
let format = match Format::<UnsignedInt, u64>::parse(format_string) {
|
||||
Ok(format) => Ok(format),
|
||||
|
|
|
@ -61,7 +61,7 @@ mod exact_searcher_tests {
|
|||
let matcher = ExactMatcher::new("a".as_bytes());
|
||||
let iter = Searcher::new(&matcher, "".as_bytes());
|
||||
let items: Vec<(usize, usize)> = iter.collect();
|
||||
assert_eq!(vec![] as Vec<(usize, usize)>, items);
|
||||
assert!(items.is_empty());
|
||||
}
|
||||
|
||||
fn test_multibyte(line: &[u8], expected: &[(usize, usize)]) {
|
||||
|
@ -140,7 +140,7 @@ mod whitespace_searcher_tests {
|
|||
let matcher = WhitespaceMatcher {};
|
||||
let iter = Searcher::new(&matcher, "".as_bytes());
|
||||
let items: Vec<(usize, usize)> = iter.collect();
|
||||
assert_eq!(vec![] as Vec<(usize, usize)>, items);
|
||||
assert!(items.is_empty());
|
||||
}
|
||||
|
||||
fn test_multispace(line: &[u8], expected: &[(usize, usize)]) {
|
||||
|
|
|
@ -442,7 +442,7 @@ fn parse_bytes_only(s: &str, i: usize) -> Result<u64, ParseError> {
|
|||
/// 512. You can also use standard block size suffixes like `'k'` for
|
||||
/// 1024.
|
||||
///
|
||||
/// If the number would be too large, return [`std::u64::MAX`] instead.
|
||||
/// If the number would be too large, return [`u64::MAX`] instead.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
|
|
|
@ -124,10 +124,7 @@ pub enum MainFunction {
|
|||
impl Behavior {
|
||||
/// Determine the mode for chmod after copy.
|
||||
pub fn mode(&self) -> u32 {
|
||||
match self.specified_mode {
|
||||
Some(x) => x,
|
||||
None => DEFAULT_MODE,
|
||||
}
|
||||
self.specified_mode.unwrap_or(DEFAULT_MODE)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,11 +104,11 @@ impl<'a> StyleManager<'a> {
|
|||
ret
|
||||
}
|
||||
|
||||
pub(crate) fn is_current_style(&mut self, new_style: &Style) -> bool {
|
||||
matches!(&self.current_style,Some(style) if style == new_style )
|
||||
pub(crate) fn is_current_style(&self, new_style: &Style) -> bool {
|
||||
matches!(&self.current_style, Some(style) if style == new_style)
|
||||
}
|
||||
|
||||
pub(crate) fn is_reset(&mut self) -> bool {
|
||||
pub(crate) fn is_reset(&self) -> bool {
|
||||
self.current_style.is_none()
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
use half::f16;
|
||||
use std::f32;
|
||||
use std::f64;
|
||||
use std::num::FpCategory;
|
||||
|
||||
use crate::formatteriteminfo::{FormatWriter, FormatterItemInfo};
|
||||
|
|
|
@ -535,7 +535,7 @@ impl LineFormat {
|
|||
|
||||
let mut parts = checksum.splitn(2, |&b| b == b'=');
|
||||
let main = parts.next().unwrap(); // Always exists since checksum isn't empty
|
||||
let padding = parts.next().unwrap_or(&b""[..]); // Empty if no '='
|
||||
let padding = parts.next().unwrap_or_default(); // Empty if no '='
|
||||
|
||||
main.iter()
|
||||
.all(|&b| b.is_ascii_alphanumeric() || b == b'+' || b == b'/')
|
||||
|
|
|
@ -1123,7 +1123,7 @@ mod test {
|
|||
U: Formatter<T>,
|
||||
{
|
||||
let mut v = Vec::<u8>::new();
|
||||
format.fmt(&mut v, n as T).unwrap();
|
||||
format.fmt(&mut v, n).unwrap();
|
||||
String::from_utf8_lossy(&v).to_string()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue