Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace format! with other macros/methods when unnecessary #176

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn build_shell_completions(out_dir: &Path) -> Result<(), IoError> {
fn build_manpage(out_dir: &Path) -> Result<(), IoError> {
fs::create_dir_all(out_dir)?;
let app = args::get_args();
let file = out_dir.join(format!("{}.8", env!("CARGO_PKG_NAME")));
let file = out_dir.join(concat!(env!("CARGO_PKG_NAME"), ".8"));
let mut file = File::create(file)?;
Man::new(app).render(&mut file)?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
.border_style(self.style.colored)
.borders(Borders::ALL)
.title(Span::styled(
&format!(

Check failure on line 347 in src/app.rs

View workflow job for this annotation

GitHub Actions / Build for x86_64-unknown-linux-gnu using Rust stable (on ubuntu-22.04)

the borrowed expression implements the required traits

Check failure on line 347 in src/app.rs

View workflow job for this annotation

GitHub Actions / Build for x86_64-unknown-linux-musl using Rust stable (on ubuntu-22.04)

the borrowed expression implements the required traits
"{}{}",
info[0],
self.style.unicode.get(Symbol::Gear)
Expand Down Expand Up @@ -383,7 +383,7 @@
for module in &mut kernel_module_list {
if module[2].len() > dependent_width {
module[2].truncate(dependent_width);
module[2] = format!("{}...", module[2]);
module[2].push_str("...");
}
}
kernel_modules.list = kernel_module_list;
Expand Down
7 changes: 5 additions & 2 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ pub fn get_args() -> App {
App::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS"))
.about(format!(
"{} {}\n{}\n{}\n\n{}",
.about(concat!(
env!("CARGO_PKG_NAME"),
" ",
env!("CARGO_PKG_VERSION"),
"\n",
env!("CARGO_PKG_AUTHORS"),
"\n",
env!("CARGO_PKG_DESCRIPTION"),
"\n\n",
"Press '?' while running the terminal UI to see key bindings."
))
.before_help(ASCII_LOGO)
Expand Down
3 changes: 2 additions & 1 deletion src/kernel/lkm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ impl KernelModules<'_> {
let columns: Vec<&str> = line.split_whitespace().collect();
let mut module_name = format!(" {}", columns[0]);
if columns.len() >= 7 {
module_name = format!("{} {}", module_name, columns[6]);
module_name.push(' ');
module_name.push_str(columns[6]);
}
let mut used_modules = format!("{} {}", columns[2], columns[3]);
if used_modules.ends_with(',') {
Expand Down
Loading