summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar 13r0ck <brock@szu.email>2023-01-27 13:25:04 -0700
committerLibravatar 13r0ck <brock@szu.email>2023-01-27 14:02:48 -0700
commit42b1bfe66d2407901c1ae640f80ce9e0d3c64b60 (patch)
tree2057c57df0c36096d1c3cd6334bc16e767f8169e /examples
parente6092e81a42efe0bbaaad2e7ce475c25a379e672 (diff)
downloadiced-42b1bfe66d2407901c1ae640f80ce9e0d3c64b60.tar.gz
iced-42b1bfe66d2407901c1ae640f80ce9e0d3c64b60.tar.bz2
iced-42b1bfe66d2407901c1ae640f80ce9e0d3c64b60.zip
Fix: Clippy lint 'uninlined_format_args'
Diffstat (limited to 'examples')
-rw-r--r--examples/download_progress/src/main.rs2
-rw-r--r--examples/events/src/main.rs2
-rw-r--r--examples/game_of_life/src/main.rs2
-rw-r--r--examples/integration_opengl/src/controls.rs2
-rw-r--r--examples/integration_opengl/src/scene.rs2
-rw-r--r--examples/integration_wgpu/src/controls.rs2
-rw-r--r--examples/integration_wgpu/src/main.rs2
-rw-r--r--examples/pokedex/src/main.rs8
-rw-r--r--examples/styling/src/main.rs2
-rw-r--r--examples/system_information/src/main.rs5
-rw-r--r--examples/todos/src/main.rs2
-rw-r--r--examples/tour/src/main.rs8
-rw-r--r--examples/websocket/src/echo.rs2
-rw-r--r--examples/websocket/src/echo/server.rs2
14 files changed, 20 insertions, 23 deletions
diff --git a/examples/download_progress/src/main.rs b/examples/download_progress/src/main.rs
index 3ef9ef7a..001a1f8f 100644
--- a/examples/download_progress/src/main.rs
+++ b/examples/download_progress/src/main.rs
@@ -177,7 +177,7 @@ impl Download {
.into()
}
State::Downloading { .. } => {
- text(format!("Downloading... {:.2}%", current_progress)).into()
+ text(format!("Downloading... {current_progress:.2}%")).into()
}
State::Errored => column![
"Something went wrong :(",
diff --git a/examples/events/src/main.rs b/examples/events/src/main.rs
index 4ae8d6fb..0e583479 100644
--- a/examples/events/src/main.rs
+++ b/examples/events/src/main.rs
@@ -77,7 +77,7 @@ impl Application for Events {
let events = Column::with_children(
self.last
.iter()
- .map(|event| text(format!("{:?}", event)).size(40))
+ .map(|event| text(format!("{event:?}")).size(40))
.map(Element::from)
.collect(),
);
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index b0f1c96d..ed911160 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -176,7 +176,7 @@ fn view_controls<'a>(
let speed_controls = row![
slider(1.0..=1000.0, speed as f32, Message::SpeedChanged),
- text(format!("x{}", speed)).size(16),
+ text(format!("x{speed}")).size(16),
]
.width(Length::Fill)
.align_items(Alignment::Center)
diff --git a/examples/integration_opengl/src/controls.rs b/examples/integration_opengl/src/controls.rs
index 076d37d3..22c41066 100644
--- a/examples/integration_opengl/src/controls.rs
+++ b/examples/integration_opengl/src/controls.rs
@@ -90,7 +90,7 @@ impl Program for Controls {
)
.push(sliders)
.push(
- Text::new(format!("{:?}", background_color))
+ Text::new(format!("{background_color:?}"))
.size(14)
.style(Color::WHITE),
),
diff --git a/examples/integration_opengl/src/scene.rs b/examples/integration_opengl/src/scene.rs
index fc74b78a..c1d05b65 100644
--- a/examples/integration_opengl/src/scene.rs
+++ b/examples/integration_opengl/src/scene.rs
@@ -49,7 +49,7 @@ impl Scene {
.expect("Cannot create shader");
gl.shader_source(
shader,
- &format!("{}\n{}", shader_version, shader_source),
+ &format!("{shader_version}\n{shader_source}"),
);
gl.compile_shader(shader);
if !gl.get_shader_compile_status(shader) {
diff --git a/examples/integration_wgpu/src/controls.rs b/examples/integration_wgpu/src/controls.rs
index 6c41738c..92300a45 100644
--- a/examples/integration_wgpu/src/controls.rs
+++ b/examples/integration_wgpu/src/controls.rs
@@ -96,7 +96,7 @@ impl Program for Controls {
)
.push(sliders)
.push(
- Text::new(format!("{:?}", background_color))
+ Text::new(format!("{background_color:?}"))
.size(14)
.style(Color::WHITE),
)
diff --git a/examples/integration_wgpu/src/main.rs b/examples/integration_wgpu/src/main.rs
index 70f9a48b..2a56b6fa 100644
--- a/examples/integration_wgpu/src/main.rs
+++ b/examples/integration_wgpu/src/main.rs
@@ -274,7 +274,7 @@ pub fn main() {
}
Err(error) => match error {
wgpu::SurfaceError::OutOfMemory => {
- panic!("Swapchain error: {}. Rendering cannot continue.", error)
+ panic!("Swapchain error: {error}. Rendering cannot continue.")
}
_ => {
// Try rendering again next frame.
diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs
index 4fe2d07c..748acae0 100644
--- a/examples/pokedex/src/main.rs
+++ b/examples/pokedex/src/main.rs
@@ -41,7 +41,7 @@ impl Application for Pokedex {
Pokedex::Errored { .. } => "Whoops!",
};
- format!("{} - Pokédex", subtitle)
+ format!("{subtitle} - Pokédex")
}
fn update(&mut self, message: Message) -> Command<Message> {
@@ -157,8 +157,7 @@ impl Pokemon {
};
let fetch_entry = async {
- let url =
- format!("https://pokeapi.co/api/v2/pokemon-species/{}", id);
+ let url = format!("https://pokeapi.co/api/v2/pokemon-species/{id}");
reqwest::get(&url).await?.json().await
};
@@ -187,8 +186,7 @@ impl Pokemon {
async fn fetch_image(id: u16) -> Result<image::Handle, reqwest::Error> {
let url = format!(
- "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{}.png",
- id
+ "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{id}.png"
);
#[cfg(not(target_arch = "wasm32"))]
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index e16860ad..49bedce7 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -78,7 +78,7 @@ impl Sandbox for Styling {
column![text("Choose a theme:")].spacing(10),
|column, theme| {
column.push(radio(
- format!("{:?}", theme),
+ format!("{theme:?}"),
*theme,
Some(match self.theme {
Theme::Light => ThemeType::Light,
diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs
index 175b4387..633b6e2b 100644
--- a/examples/system_information/src/main.rs
+++ b/examples/system_information/src/main.rs
@@ -114,13 +114,12 @@ impl Application for Example {
{
let memory_readable = ByteSize::kb(memory_used).to_string();
- format!("{} kb ({})", memory_used, memory_readable)
+ format!("{memory_used} kb ({memory_readable})")
} else {
String::from("None")
};
- let memory_used =
- text(format!("Memory (used): {}", memory_text));
+ let memory_used = text(format!("Memory (used): {memory_text}"));
let graphics_adapter = text(format!(
"Graphics adapter: {}",
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 690d9c09..04411ed7 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -303,7 +303,7 @@ pub enum TaskMessage {
impl Task {
fn text_input_id(i: usize) -> text_input::Id {
- text_input::Id::new(format!("task-{}", i))
+ text_input::Id::new(format!("task-{i}"))
}
fn new(description: String) -> Self {
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index 378508e1..5ee65562 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -388,7 +388,7 @@ impl<'a> Step {
let spacing_section = column![
slider(0..=80, spacing, StepMessage::SpacingChanged),
- text(format!("{} px", spacing))
+ text(format!("{spacing} px"))
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Center),
]
@@ -412,7 +412,7 @@ impl<'a> Step {
fn text(size: u16, color: Color) -> Column<'a, StepMessage> {
let size_section = column![
"You can change its size:",
- text(format!("This text is {} pixels", size)).size(size),
+ text(format!("This text is {size} pixels")).size(size),
slider(10..=70, size, StepMessage::TextSizeChanged),
]
.padding(20)
@@ -427,7 +427,7 @@ impl<'a> Step {
let color_section = column![
"And its color:",
- text(format!("{:?}", color)).style(color),
+ text(format!("{color:?}")).style(color),
color_sliders,
]
.padding(20)
@@ -497,7 +497,7 @@ impl<'a> Step {
.push(ferris(width))
.push(slider(100..=500, width, StepMessage::ImageWidthChanged))
.push(
- text(format!("Width: {} px", width))
+ text(format!("Width: {width} px"))
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Center),
)
diff --git a/examples/websocket/src/echo.rs b/examples/websocket/src/echo.rs
index ae65e064..e74768a6 100644
--- a/examples/websocket/src/echo.rs
+++ b/examples/websocket/src/echo.rs
@@ -141,7 +141,7 @@ impl fmt::Display for Message {
Message::Disconnected => {
write!(f, "Connection lost... Retrying...")
}
- Message::User(message) => write!(f, "{}", message),
+ Message::User(message) => write!(f, "{message}"),
}
}
}
diff --git a/examples/websocket/src/echo/server.rs b/examples/websocket/src/echo/server.rs
index fef89a12..dd234984 100644
--- a/examples/websocket/src/echo/server.rs
+++ b/examples/websocket/src/echo/server.rs
@@ -41,7 +41,7 @@ async fn user_connected(ws: WebSocket) {
tokio::task::spawn(async move {
while let Some(message) = rx.next().await {
user_ws_tx.send(message).await.unwrap_or_else(|e| {
- eprintln!("websocket send error: {}", e);
+ eprintln!("websocket send error: {e}");
});
}
});