diff --git a/examples/camera_transformations.rs b/examples/camera_transformations.rs index 46823a67..7948b433 100644 --- a/examples/camera_transformations.rs +++ b/examples/camera_transformations.rs @@ -128,14 +128,14 @@ async fn main() { BLACK, ); draw_text( - format!("rotation (mouse wheel) = {} degrees", rotation).as_str(), + format!("rotation (mouse wheel) = {rotation} degrees").as_str(), 10.0, 25.0, 15.0, BLACK, ); draw_text( - format!("zoom (ctrl + mouse wheel) = {:.2}", zoom).as_str(), + format!("zoom (ctrl + mouse wheel) = {zoom:.2}").as_str(), 10.0, 40.0, 15.0, diff --git a/examples/events.rs b/examples/events.rs index 38cecb63..52371c45 100644 --- a/examples/events.rs +++ b/examples/events.rs @@ -8,11 +8,11 @@ async fn main() { clear_background(WHITE); root_ui().window(hash!(), Vec2::new(20., 20.), Vec2::new(450., 200.), |ui| { let (mouse_x, mouse_y) = mouse_position(); - ui.label(None, &format!("Mouse position: {} {}", mouse_x, mouse_y)); + ui.label(None, &format!("Mouse position: {mouse_x} {mouse_y}")); let (mouse_wheel_x, mouse_wheel_y) = mouse_wheel(); - ui.label(None, &format!("Mouse wheel x: {}", mouse_wheel_x)); - ui.label(None, &format!("Mouse wheel y: {}", mouse_wheel_y)); + ui.label(None, &format!("Mouse wheel x: {mouse_wheel_x}")); + ui.label(None, &format!("Mouse wheel y: {mouse_wheel_y}")); widgets::Group::new(hash!(), Vec2::new(200., 90.)) .position(Vec2::new(240., 0.)) @@ -20,7 +20,7 @@ async fn main() { ui.label(None, "Pressed kbd keys"); if let Some(key) = get_last_key_pressed() { - ui.label(None, &format!("{:?}", key)) + ui.label(None, &format!("{key:?}")) } }); diff --git a/examples/first_person.rs b/examples/first_person.rs index 25d4460f..a73a7d88 100644 --- a/examples/first_person.rs +++ b/examples/first_person.rs @@ -129,7 +129,7 @@ async fn main() { BLACK, ); draw_text( - format!("Press to toggle mouse grab: {}", grabbed).as_str(), + format!("Press to toggle mouse grab: {grabbed}").as_str(), 10.0, 48.0 + 42.0, 30.0, diff --git a/examples/shadertoy.rs b/examples/shadertoy.rs index 507d4d6d..e3d8f882 100644 --- a/examples/shadertoy.rs +++ b/examples/shadertoy.rs @@ -145,7 +145,7 @@ async fn main() { ui.separator(); for (i, (name, uniform)) in uniforms.iter_mut().enumerate() { - ui.label(None, &format!("{}", name)); + ui.label(None, &format!("{name}")); ui.same_line(120.0); match uniform { @@ -356,7 +356,7 @@ async fn main() { error = None; } Err(err) => { - error = Some(format!("{:#?}", err)); + error = Some(format!("{err:#?}")); } } } diff --git a/examples/ui.rs b/examples/ui.rs index b52b4d63..4f9003dd 100644 --- a/examples/ui.rs +++ b/examples/ui.rs @@ -156,11 +156,11 @@ async fn main() { .ui(&mut *root_ui(), |ui| { for i in 0..30 { Group::new(hash!("shop", i), Vec2::new(300., 80.)).ui(ui, |ui| { - ui.label(Vec2::new(10., 10.), &format!("Item N {}", i)); + ui.label(Vec2::new(10., 10.), &format!("Item N {i}")); ui.label(Vec2::new(260., 40.), "10/10"); ui.label(Vec2::new(200., 58.), &format!("{} kr", 800)); if ui.button(Vec2::new(260., 55.), "buy") { - data.inventory.push(format!("Item {}", i)); + data.inventory.push(format!("Item {i}")); } }); } @@ -198,10 +198,7 @@ async fn main() { ui.input_text(hash!(), "<- input text 1", &mut data0); ui.input_text(hash!(), "<- input text 2", &mut data1); - ui.label( - None, - &format!("Text entered: \"{}\" and \"{}\"", data0, data1), - ); + ui.label(None, &format!("Text entered: \"{data0}\" and \"{data1}\"")); ui.separator(); }); diff --git a/src/error.rs b/src/error.rs index d1d7f351..ce51582f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -30,7 +30,7 @@ impl From for Error { impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "error: {:?}", self) + write!(f, "error: {self:?}") } } diff --git a/src/file.rs b/src/file.rs index b7cbff8a..c78e34c5 100644 --- a/src/file.rs +++ b/src/file.rs @@ -31,7 +31,7 @@ pub async fn load_file(path: &str) -> Result, Error> { #[cfg(not(target_os = "android"))] let path = if let Some(ref pc_assets) = crate::get_context().pc_assets_folder { - format!("{}/{}", pc_assets, path) + format!("{pc_assets}/{path}") } else { path.to_string() }; diff --git a/src/material.rs b/src/material.rs index 25f6f922..8386aae2 100644 --- a/src/material.rs +++ b/src/material.rs @@ -153,8 +153,7 @@ pub mod shaders { .iter() .find(|(name, _)| name == &filename) .expect(&format!( - "Include file {} in not on \"includes\" list", - filename + "Include file {filename} in not on \"includes\" list" )); let _ = res diff --git a/src/quad_gl.rs b/src/quad_gl.rs index 1b3a699e..79c24beb 100644 --- a/src/quad_gl.rs +++ b/src/quad_gl.rs @@ -149,7 +149,7 @@ impl MagicSnapshotter { }, snapshotter_shader::meta(), ) - .unwrap_or_else(|e| panic!("Failed to load shader: {}", e)); + .unwrap_or_else(|e| panic!("Failed to load shader: {e}")); let pipeline = ctx.new_pipeline( &[BufferLayout::default()], @@ -396,7 +396,7 @@ impl PipelinesStorage { }, shader::meta(), ) - .unwrap_or_else(|e| panic!("Failed to load shader: {}", e)); + .unwrap_or_else(|e| panic!("Failed to load shader: {e}")); let params = PipelineParams { color_blend: Some(BlendState::new( diff --git a/src/texture.rs b/src/texture.rs index b4376e20..39fc2b93 100644 --- a/src/texture.rs +++ b/src/texture.rs @@ -931,7 +931,7 @@ pub fn build_textures_atlas() { let texture = context.texture_batcher.atlas.texture(); let (w, h) = get_quad_context().texture_size(texture); - crate::telemetry::log_string(&format!("Atlas: {} {}", w, h)); + crate::telemetry::log_string(&format!("Atlas: {w} {h}")); } #[doc(hidden)] diff --git a/src/window.rs b/src/window.rs index d4699e77..4aad3af4 100644 --- a/src/window.rs +++ b/src/window.rs @@ -124,7 +124,7 @@ where F: Fn(String, String) -> T + Send + Sync + 'static, { std::panic::set_hook(Box::new(move |info| { - let message = format!("{:?}", info); + let message = format!("{info:?}"); #[cfg(feature = "backtrace")] let backtrace_string = format!("{:?}", backtrace::Backtrace::new()); #[cfg(not(feature = "backtrace"))] diff --git a/tests/back_to_the_future_coroutines.rs b/tests/back_to_the_future_coroutines.rs index 407119c5..fe803c3d 100644 --- a/tests/back_to_the_future_coroutines.rs +++ b/tests/back_to_the_future_coroutines.rs @@ -30,7 +30,7 @@ async fn back_to_the_future_coroutine() { }); let mut i = 10; loop { - println!("{}", i); + println!("{i}"); if player2.lock().unwrap().allow_movement { break; }