Skip to content

Commit

Permalink
refactor: replace format! with concat! for string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral-Tech committed Dec 13, 2024
1 parent a687a83 commit f436479
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
6 changes: 3 additions & 3 deletions examples/editor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ impl Editor {
},
Task::batch([
Task::perform(
load_file(format!(
"{}/src/main.rs",
env!("CARGO_MANIFEST_DIR")
load_file(concat!(
env!("CARGO_MANIFEST_DIR"),
"/src/main.rs",
)),
Message::FileOpened,
),
Expand Down
6 changes: 3 additions & 3 deletions examples/ferris/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ impl Image {
let i_am_ferris = column![
"Hello!",
Element::from(
image(format!(
"{}/../tour/images/ferris.png",
env!("CARGO_MANIFEST_DIR")
image(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../tour/images/ferris.png",
))
.width(self.width)
.content_fit(self.content_fit)
Expand Down
6 changes: 3 additions & 3 deletions examples/svg/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ impl Tiger {
}

fn view(&self) -> Element<Message> {
let handle = svg::Handle::from_path(format!(
"{}/resources/tiger.svg",
env!("CARGO_MANIFEST_DIR")
let handle = svg::Handle::from_path(concat!(
env!("CARGO_MANIFEST_DIR"),
"/resources/tiger.svg",
));

let svg =
Expand Down
2 changes: 1 addition & 1 deletion examples/tour/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ fn ferris<'a>(
if cfg!(target_arch = "wasm32") {
image("tour/images/ferris.png")
} else {
image(format!("{}/images/ferris.png", env!("CARGO_MANIFEST_DIR")))
image(concat!(env!("CARGO_MANIFEST_DIR"), "/images/ferris.png"))
}
.filter_method(filter_method)
.width(width),
Expand Down
16 changes: 10 additions & 6 deletions runtime/src/debug/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,16 @@ impl Debug {
format!("{key} {value:?}")
}

lines.push(format!(
"{} {} - {}",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),
env!("CARGO_PKG_REPOSITORY"),
));
lines.push(
concat!(
env!("CARGO_PKG_NAME"),
" ",
env!("CARGO_PKG_VERSION"),
" - ",
env!("CARGO_PKG_REPOSITORY"),
)
.to_string(),
);
lines.push(key_value("Startup:", self.startup_duration));
lines.push(key_value("Update:", self.update_durations.average()));
lines.push(key_value("View:", self.view_durations.average()));
Expand Down

0 comments on commit f436479

Please sign in to comment.