Skip to content

Commit

Permalink
refactor: replace format! with concat! for string literals (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral-Tech authored Dec 8, 2024
1 parent bd12db0 commit eae4140
Show file tree
Hide file tree
Showing 4 changed files with 5 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 @@ -16,7 +16,7 @@ use std::path::PathBuf;
/// See <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
fn main() -> Result<()> {
let out_dir = env::var("OUT_DIR").expect("OUT_DIR 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 = CliArgs::command();
let man = Man::new(app);
let mut buffer = Vec::<u8>::new();
Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Config {
#[inline(always)]
fn get_default_locations() -> Option<Vec<PathBuf>> {
if let Some(config_dir) = dirs::config_dir() {
let file_name = format!("{}.toml", env!("CARGO_PKG_NAME"));
let file_name = concat!(env!("CARGO_PKG_NAME"), ".toml");
return Some(vec![
config_dir.join(&file_name),

Check failure on line 87 in src/config.rs

View workflow job for this annotation

GitHub Actions / Lint

the borrowed expression implements the required traits
config_dir.join(env!("CARGO_PKG_NAME")).join(&file_name), // XDG style

Check failure on line 88 in src/config.rs

View workflow job for this annotation

GitHub Actions / Lint

the borrowed expression implements the required traits
Expand Down Expand Up @@ -132,7 +132,7 @@ mod tests {
fn test_parse_config() -> Result<()> {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("config")
.join(format!("{}.toml", env!("CARGO_PKG_NAME")));
.join(concat!(env!("CARGO_PKG_NAME"), ".toml"));
if let Some(global_path) = Config::get_default_location() {
path = global_path;
}
Expand Down
2 changes: 1 addition & 1 deletion src/helper/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ mod tests {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("target")
.join("debug")
.join(format!("{}-test", env!("CARGO_PKG_NAME")))
.join(concat!(env!("CARGO_PKG_NAME"), "-test"))
.to_string_lossy()
.to_string()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn get_argument_help() -> Result<()> {
config: Some(
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("config")
.join(format!("{}.toml", env!("CARGO_PKG_NAME"))),
.join(concat!(env!("CARGO_PKG_NAME"), ".toml")),
),
..Default::default()
};
Expand Down

0 comments on commit eae4140

Please sign in to comment.