Skip to content

Commit

Permalink
refactor: replace format! with concat! for string literals (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral-Tech authored Dec 8, 2024
1 parent 795f075 commit 46f74ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bin/mangen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const OUT_DIR_ENV: &str = "OUT_DIR";
/// See <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
fn main() -> Result<()> {
let out_dir = env::var(OUT_DIR_ENV).unwrap_or_else(|_| panic!("{OUT_DIR_ENV} is not set"));
let out_path = PathBuf::from(out_dir).join(format!("{}.1", env!("CARGO_PKG_NAME")));
let out_path = PathBuf::from(out_dir).join(concat!(env!("CARGO_PKG_NAME"), ".1"));
let app = Args::command();
let man = Man::new(app);
let mut buffer = Vec::<u8>::new();
Expand Down
10 changes: 6 additions & 4 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,20 @@ fn highlight_search_result(value: String, app: &App) -> Line {

fn render_header(app: &mut App, frame: &mut Frame<'_>, area: Rect) {
let title = Paragraph::new(
format!(
" {} - {} ",
concat!(
" ",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_DESCRIPTION")
" - ",
env!("CARGO_PKG_DESCRIPTION"),
" ",
)
.bold(),
)
.block(Block::default().style(app.theme.header))
.alignment(Alignment::Left);
frame.render_widget(title, area);

let text = format!("v{} with ♥ by @orhun ", env!("CARGO_PKG_VERSION"));
let text = concat!("v", env!("CARGO_PKG_VERSION"), " with ♥ by @orhun ");
let meta = Paragraph::new(text)
.block(Block::default().style(app.theme.header))
.alignment(Alignment::Right);
Expand Down

0 comments on commit 46f74ed

Please sign in to comment.