summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2021-11-10 23:59:35 +0700
committerLibravatar GitHub <noreply@github.com>2021-11-10 23:59:35 +0700
commitf084ed8df154a7f3b0386cfb7e13307f6a6290d0 (patch)
treed4897e0ff06db7cc0fa774550e51f78347d78eb2 /examples
parenteafad00af2a9bae9f3ed8124e2a6f6e59ee5d253 (diff)
parente6627bb96ded028bb6e820965c271430870af629 (diff)
downloadiced-f084ed8df154a7f3b0386cfb7e13307f6a6290d0.tar.gz
iced-f084ed8df154a7f3b0386cfb7e13307f6a6290d0.tar.bz2
iced-f084ed8df154a7f3b0386cfb7e13307f6a6290d0.zip
Merge pull request #1106 from RamType0/RemoveUnnecessaryStringAllocationInExample
Remove unnecessary String allocation
Diffstat (limited to 'examples')
-rw-r--r--examples/scrollable/src/main.rs2
-rw-r--r--examples/styling/src/main.rs2
-rw-r--r--examples/todos/src/main.rs4
-rw-r--r--examples/tour/src/main.rs12
4 files changed, 9 insertions, 11 deletions
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs
index 3416b83d..8e027504 100644
--- a/examples/scrollable/src/main.rs
+++ b/examples/scrollable/src/main.rs
@@ -72,7 +72,7 @@ impl Sandbox for ScrollableDemo {
column.push(
Radio::new(
*option,
- &format!("{:?}", option),
+ format!("{:?}", option),
Some(*theme),
Message::ThemeChanged,
)
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index 262db03e..4e319285 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -60,7 +60,7 @@ impl Sandbox for Styling {
column.push(
Radio::new(
*theme,
- &format!("{:?}", theme),
+ format!("{:?}", theme),
Some(self.theme),
Message::ThemeChanged,
)
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 5ad8c208..0b889407 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -376,7 +376,7 @@ impl Controls {
.spacing(20)
.align_items(Alignment::Center)
.push(
- Text::new(&format!(
+ Text::new(format!(
"{} {} left",
tasks_left,
if tasks_left == 1 { "task" } else { "tasks" }
@@ -466,7 +466,7 @@ const ICONS: Font = Font::External {
};
fn icon(unicode: char) -> Text {
- Text::new(&unicode.to_string())
+ Text::new(unicode.to_string())
.font(ICONS)
.width(Length::Units(20))
.horizontal_alignment(alignment::Horizontal::Center)
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index b5af48c7..b0e87920 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -417,7 +417,7 @@ impl<'a> Step {
StepMessage::SliderChanged,
))
.push(
- Text::new(&value.to_string())
+ Text::new(value.to_string())
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Center),
)
@@ -464,7 +464,7 @@ impl<'a> Step {
StepMessage::SpacingChanged,
))
.push(
- Text::new(&format!("{} px", spacing))
+ Text::new(format!("{} px", spacing))
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Center),
);
@@ -496,9 +496,7 @@ impl<'a> Step {
.padding(20)
.spacing(20)
.push(Text::new("You can change its size:"))
- .push(
- Text::new(&format!("This text is {} pixels", size)).size(size),
- )
+ .push(Text::new(format!("This text is {} pixels", size)).size(size))
.push(Slider::new(
size_slider,
10..=70,
@@ -518,7 +516,7 @@ impl<'a> Step {
.padding(20)
.spacing(20)
.push(Text::new("And its color:"))
- .push(Text::new(&format!("{:?}", color)).color(color))
+ .push(Text::new(format!("{:?}", color)).color(color))
.push(color_sliders);
Self::container("Text")
@@ -589,7 +587,7 @@ impl<'a> Step {
StepMessage::ImageWidthChanged,
))
.push(
- Text::new(&format!("Width: {} px", width.to_string()))
+ Text::new(format!("Width: {} px", width.to_string()))
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Center),
)