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 concat! for string literals #2695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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