Skip to content

Commit be0badf

Browse files
committed
Fix: clippy lint 'uninlined_format_args'
1 parent e6092e8 commit be0badf

25 files changed

Lines changed: 47 additions & 54 deletions

File tree

examples/download_progress/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl Download {
177177
.into()
178178
}
179179
State::Downloading { .. } => {
180-
text(format!("Downloading... {:.2}%", current_progress)).into()
180+
text(format!("Downloading... {current_progress:.2}%")).into()
181181
}
182182
State::Errored => column![
183183
"Something went wrong :(",

examples/events/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl Application for Events {
7777
let events = Column::with_children(
7878
self.last
7979
.iter()
80-
.map(|event| text(format!("{:?}", event)).size(40))
80+
.map(|event| text(format!("{event:?}")).size(40))
8181
.map(Element::from)
8282
.collect(),
8383
);

examples/game_of_life/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn view_controls<'a>(
176176

177177
let speed_controls = row![
178178
slider(1.0..=1000.0, speed as f32, Message::SpeedChanged),
179-
text(format!("x{}", speed)).size(16),
179+
text(format!("x{speed}")).size(16),
180180
]
181181
.width(Length::Fill)
182182
.align_items(Alignment::Center)

examples/integration_opengl/src/controls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Program for Controls {
9090
)
9191
.push(sliders)
9292
.push(
93-
Text::new(format!("{:?}", background_color))
93+
Text::new(format!("{background_color:?}"))
9494
.size(14)
9595
.style(Color::WHITE),
9696
),

examples/integration_opengl/src/scene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Scene {
4949
.expect("Cannot create shader");
5050
gl.shader_source(
5151
shader,
52-
&format!("{}\n{}", shader_version, shader_source),
52+
&format!("{shader_version}\n{shader_source}"),
5353
);
5454
gl.compile_shader(shader);
5555
if !gl.get_shader_compile_status(shader) {

examples/integration_wgpu/src/controls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl Program for Controls {
9696
)
9797
.push(sliders)
9898
.push(
99-
Text::new(format!("{:?}", background_color))
99+
Text::new(format!("{background_color:?}"))
100100
.size(14)
101101
.style(Color::WHITE),
102102
)

examples/integration_wgpu/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ pub fn main() {
274274
}
275275
Err(error) => match error {
276276
wgpu::SurfaceError::OutOfMemory => {
277-
panic!("Swapchain error: {}. Rendering cannot continue.", error)
277+
panic!("Swapchain error: {error}. Rendering cannot continue.")
278278
}
279279
_ => {
280280
// Try rendering again next frame.

examples/pokedex/src/main.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Application for Pokedex {
4141
Pokedex::Errored { .. } => "Whoops!",
4242
};
4343

44-
format!("{} - Pokédex", subtitle)
44+
format!("{subtitle} - Pokédex")
4545
}
4646

4747
fn update(&mut self, message: Message) -> Command<Message> {
@@ -157,8 +157,7 @@ impl Pokemon {
157157
};
158158

159159
let fetch_entry = async {
160-
let url =
161-
format!("https://pokeapi.co/api/v2/pokemon-species/{}", id);
160+
let url = format!("https://pokeapi.co/api/v2/pokemon-species/{id}");
162161

163162
reqwest::get(&url).await?.json().await
164163
};
@@ -187,8 +186,7 @@ impl Pokemon {
187186

188187
async fn fetch_image(id: u16) -> Result<image::Handle, reqwest::Error> {
189188
let url = format!(
190-
"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{}.png",
191-
id
189+
"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{id}.png"
192190
);
193191

194192
#[cfg(not(target_arch = "wasm32"))]

examples/styling/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Sandbox for Styling {
7878
column![text("Choose a theme:")].spacing(10),
7979
|column, theme| {
8080
column.push(radio(
81-
format!("{:?}", theme),
81+
format!("{theme:?}"),
8282
*theme,
8383
Some(match self.theme {
8484
Theme::Light => ThemeType::Light,

examples/system_information/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,12 @@ impl Application for Example {
114114
{
115115
let memory_readable = ByteSize::kb(memory_used).to_string();
116116

117-
format!("{} kb ({})", memory_used, memory_readable)
117+
format!("{memory_used} kb ({memory_readable})")
118118
} else {
119119
String::from("None")
120120
};
121121

122-
let memory_used =
123-
text(format!("Memory (used): {}", memory_text));
122+
let memory_used = text(format!("Memory (used): {memory_text}"));
124123

125124
let graphics_adapter = text(format!(
126125
"Graphics adapter: {}",

0 commit comments

Comments
 (0)