From 8091e9ce1e642c3bb2c0c3c32fb6171366bc3021 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Fri, 16 Feb 2024 15:39:04 +0000 Subject: [PATCH] automatic cargo CI changes --- src/dumper.rs | 10 +++++----- src/main.rs | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/dumper.rs b/src/dumper.rs index b8ec30d..d1c65df 100644 --- a/src/dumper.rs +++ b/src/dumper.rs @@ -9,7 +9,7 @@ use libpt::log::{debug, error, trace, warn}; pub const BYTES_PER_LINE: usize = 16; pub const LINE_SEP_HORIZ: char = '─'; pub const LINE_SEP_VERT: char = '│'; -pub const CHAR_BORDER: &'static str = "|"; +pub const CHAR_BORDER: &str = "|"; pub trait DataSource: Read { fn skip(&mut self, length: usize) -> std::io::Result<()>; @@ -93,16 +93,16 @@ impl Hedu { self.display_buf += &format!("{:08X} {LINE_SEP_VERT} ", self.data_idx); if self.len != 0 { for i in 0..self.len { - if i as usize % BYTES_PER_LINE == BYTES_PER_LINE / 2 { + if i % BYTES_PER_LINE == BYTES_PER_LINE / 2 { self.display_buf += " "; } self.display_buf += &format!("{:02X} ", self.buf[self.alt_buf][i]); } if self.len == BYTES_PER_LINE / 2 { - self.display_buf += " " + self.display_buf += " "; } for i in 0..(BYTES_PER_LINE - self.len) { - if i as usize % BYTES_PER_LINE == BYTES_PER_LINE / 2 { + if i % BYTES_PER_LINE == BYTES_PER_LINE / 2 { self.display_buf += " "; } self.display_buf += " "; @@ -237,7 +237,7 @@ impl Hedu { /// interpret characters for the --chars option fn mask_chars(c: char) -> char { if c.is_ascii_graphic() { - return c; + c } else if c == '\n' { return '↩'; } else if c == ' ' { diff --git a/src/main.rs b/src/main.rs index baa269b..aa0be7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,13 +5,13 @@ use std::{fs::File, io::IsTerminal, path::PathBuf}; -use libpt::log::*; +use libpt::log::{error, trace, warn, Level, Logger}; use clap::Parser; use clap_verbosity_flag::{InfoLevel, Verbosity}; mod dumper; -use dumper::*; +use dumper::{DataSource, Hedu}; #[derive(Debug, Clone, Parser)] #[command( @@ -63,7 +63,7 @@ pub struct Cli { fn main() { let mut cli = cli_parse(); let mut sources: Vec> = Vec::new(); - if cli.data_source.len() > 0 && cli.data_source[0] != "-" { + if !cli.data_source.is_empty() && cli.data_source[0] != "-" { for data_source in &cli.data_source { let data_source: PathBuf = PathBuf::from(data_source); if data_source.is_dir() { @@ -89,7 +89,7 @@ fn main() { } // just for the little header cli.data_source = Vec::new(); - cli.data_source.push(format!("stdin")); + cli.data_source.push("stdin".to_string()); sources.push(Box::new(stdin)); } for (i, source) in sources.iter_mut().enumerate() { @@ -105,7 +105,7 @@ fn main() { } } match config.dump(&mut **source) { - Ok(_) => (), + Ok(()) => (), Err(err) => { error!("Could not dump data of file: {err}"); std::process::exit(3); @@ -135,5 +135,5 @@ fn cli_parse() -> Cli { // less verbose version Logger::init_mini(Some(ll)).expect("could not initialize Logger"); } - return cli; + cli }