diff --git a/examples/3d/anti_aliasing.rs b/examples/3d/anti_aliasing.rs index 81822c32c6..f2a58e32fa 100644 --- a/examples/3d/anti_aliasing.rs +++ b/examples/3d/anti_aliasing.rs @@ -351,7 +351,7 @@ fn setup( /// Writes a simple menu item that can be on or off. fn draw_selectable_menu_item(ui: &mut String, label: &str, shortcut: char, enabled: bool) { let star = if enabled { "*" } else { "" }; - let _ = writeln!(*ui, "({}) {}{}{}", shortcut, star, label, star); + let _ = writeln!(*ui, "({shortcut}) {star}{label}{star}"); } /// Creates a colorful test pattern diff --git a/examples/3d/color_grading.rs b/examples/3d/color_grading.rs index 9931dcc43a..f7548cb365 100644 --- a/examples/3d/color_grading.rs +++ b/examples/3d/color_grading.rs @@ -459,9 +459,9 @@ impl Display for SelectedSectionColorGradingOption { impl Display for SelectedColorGradingOption { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { - SelectedColorGradingOption::Global(option) => write!(f, "\"{}\"", option), + SelectedColorGradingOption::Global(option) => write!(f, "\"{option}\""), SelectedColorGradingOption::Section(section, option) => { - write!(f, "\"{}\" for \"{}\"", option, section) + write!(f, "\"{option}\" for \"{section}\"") } } } @@ -633,7 +633,7 @@ fn update_ui_state( /// Creates the help text at the top left of the window. fn create_help_text(currently_selected_option: &SelectedColorGradingOption) -> String { - format!("Press Left/Right to adjust {}", currently_selected_option) + format!("Press Left/Right to adjust {currently_selected_option}") } /// Processes keyboard input to change the value of the currently-selected color diff --git a/examples/3d/irradiance_volumes.rs b/examples/3d/irradiance_volumes.rs index d52b8452a5..e213c1f3a2 100644 --- a/examples/3d/irradiance_volumes.rs +++ b/examples/3d/irradiance_volumes.rs @@ -351,12 +351,11 @@ impl AppStatus { Text::from_section( format!( - "{}\n{}\n{}\n{}\n{}", - CLICK_TO_MOVE_HELP_TEXT, - voxels_help_text, - irradiance_volume_help_text, - rotation_help_text, - switch_mesh_help_text + "{CLICK_TO_MOVE_HELP_TEXT} + {voxels_help_text} + {irradiance_volume_help_text} + {rotation_help_text} + {switch_mesh_help_text}" ), TextStyle::default(), ) diff --git a/examples/app/headless_renderer.rs b/examples/app/headless_renderer.rs index f6fa5c3472..4e7c7a7f3f 100644 --- a/examples/app/headless_renderer.rs +++ b/examples/app/headless_renderer.rs @@ -533,7 +533,7 @@ fn update( // Finally saving image to file, this heavy blocking operation is kept here // for example simplicity, but in real app you should move it to a separate task if let Err(e) = img.save(image_path) { - panic!("Failed to save image: {}", e); + panic!("Failed to save image: {e}"); }; } if scene_controller.single_image { diff --git a/examples/ecs/component_hooks.rs b/examples/ecs/component_hooks.rs index 34244e7669..1828807da1 100644 --- a/examples/ecs/component_hooks.rs +++ b/examples/ecs/component_hooks.rs @@ -69,10 +69,7 @@ fn setup(world: &mut World) { .on_add(|mut world, entity, component_id| { // You can access component data from within the hook let value = world.get::(entity).unwrap().0; - println!( - "Component: {:?} added to: {:?} with value {:?}", - component_id, entity, value - ); + println!("Component: {component_id:?} added to: {entity:?} with value {value:?}"); // Or access resources world .resource_mut::() @@ -96,10 +93,7 @@ fn setup(world: &mut World) { // since it runs before the component is removed you can still access the component data .on_remove(|mut world, entity, component_id| { let value = world.get::(entity).unwrap().0; - println!( - "Component: {:?} removed from: {:?} with value {:?}", - component_id, entity, value - ); + println!("Component: {component_id:?} removed from: {entity:?} with value {value:?}"); // You can also issue commands through `.commands()` world.commands().entity(entity).despawn(); }); diff --git a/examples/ecs/dynamic.rs b/examples/ecs/dynamic.rs index 9aac6fffb2..79ec202ae4 100644 --- a/examples/ecs/dynamic.rs +++ b/examples/ecs/dynamic.rs @@ -50,7 +50,7 @@ fn main() { let mut component_names = HashMap::::new(); let mut component_info = HashMap::::new(); - println!("{}", PROMPT); + println!("{PROMPT}"); loop { print!("\n> "); let _ = std::io::stdout().flush(); @@ -64,10 +64,10 @@ fn main() { let Some((first, rest)) = line.trim().split_once(|c: char| c.is_whitespace()) else { match &line.chars().next() { - Some('c') => println!("{}", COMPONENT_PROMPT), - Some('s') => println!("{}", ENTITY_PROMPT), - Some('q') => println!("{}", QUERY_PROMPT), - _ => println!("{}", PROMPT), + Some('c') => println!("{COMPONENT_PROMPT}"), + Some('s') => println!("{ENTITY_PROMPT}"), + Some('q') => println!("{QUERY_PROMPT}"), + _ => println!("{PROMPT}"), } continue; }; @@ -112,7 +112,7 @@ fn main() { // Get the id for the component with the given name let Some(&id) = component_names.get(name) else { - println!("Component {} does not exist", name); + println!("Component {name} does not exist"); return; }; @@ -245,7 +245,7 @@ fn parse_term( }; if !matched { - println!("Unable to find component: {}", str); + println!("Unable to find component: {str}"); } } diff --git a/examples/ecs/send_and_receive_events.rs b/examples/ecs/send_and_receive_events.rs index ce65c9c1e6..cabcc26d36 100644 --- a/examples/ecs/send_and_receive_events.rs +++ b/examples/ecs/send_and_receive_events.rs @@ -102,7 +102,7 @@ fn send_events(mut events: EventWriter, frame_count: Res /// Note that some events will be printed twice, because they were sent twice. fn debug_events(mut events: EventReader) { for event in events.read() { - println!("{:?}", event); + println!("{event:?}"); } } diff --git a/examples/games/stepping.rs b/examples/games/stepping.rs index f0d5593c03..be36551d02 100644 --- a/examples/games/stepping.rs +++ b/examples/games/stepping.rs @@ -115,7 +115,7 @@ fn build_ui( for label in schedule_order { let schedule = schedules.get(*label).unwrap(); text_sections.push(TextSection::new( - format!("{:?}\n", label), + format!("{label:?}\n"), TextStyle { font: asset_server.load(FONT_BOLD), color: FONT_COLOR, diff --git a/examples/math/cubic_splines.rs b/examples/math/cubic_splines.rs index 4e4a86e60c..dbf43cef65 100644 --- a/examples/math/cubic_splines.rs +++ b/examples/math/cubic_splines.rs @@ -73,8 +73,8 @@ fn setup(mut commands: Commands) { R: Remove the last control point\n\ S: Cycle the spline construction being used\n\ C: Toggle cyclic curve construction"; - let spline_mode_text = format!("Spline: {}", spline_mode); - let cycling_mode_text = format!("{}", cycling_mode); + let spline_mode_text = format!("Spline: {spline_mode}"); + let cycling_mode_text = format!("{cycling_mode}"); let style = TextStyle::default(); commands diff --git a/examples/stress_tests/many_cubes.rs b/examples/stress_tests/many_cubes.rs index 3c04b85ea5..36f94b8adc 100644 --- a/examples/stress_tests/many_cubes.rs +++ b/examples/stress_tests/many_cubes.rs @@ -87,8 +87,7 @@ impl FromStr for Layout { "cube" => Ok(Self::Cube), "sphere" => Ok(Self::Sphere), _ => Err(format!( - "Unknown layout value: '{}', valid options: 'cube', 'sphere'", - s + "Unknown layout value: '{s}', valid options: 'cube', 'sphere'" )), } } diff --git a/examples/time/time.rs b/examples/time/time.rs index bf8ebfc9ed..0f18c63001 100644 --- a/examples/time/time.rs +++ b/examples/time/time.rs @@ -37,7 +37,7 @@ fn runner(mut app: App) -> AppExit { let stdin = io::stdin(); for line in stdin.lock().lines() { if let Err(err) = line { - println!("read err: {:#}", err); + println!("read err: {err:#}"); break; } match line.unwrap().as_str() { diff --git a/tests/ecs/ambiguity_detection.rs b/tests/ecs/ambiguity_detection.rs index 39cb05a5cf..ee062746ae 100644 --- a/tests/ecs/ambiguity_detection.rs +++ b/tests/ecs/ambiguity_detection.rs @@ -34,8 +34,7 @@ fn main() { assert_eq!( main_app_ambiguities.total(), 0, - "Main app has unexpected ambiguities among the following schedules: \n{:#?}.", - main_app_ambiguities, + "Main app has unexpected ambiguities among the following schedules: \n{main_app_ambiguities:#?}.", ); // RenderApp is not checked here, because it is not within the App at this point. @@ -43,8 +42,7 @@ fn main() { assert_eq!( render_extract_ambiguities.total(), 0, - "RenderExtract app has unexpected ambiguities among the following schedules: \n{:#?}", - render_extract_ambiguities, + "RenderExtract app has unexpected ambiguities among the following schedules: \n{render_extract_ambiguities:#?}", ); }