diff --git a/crates/bevy_plugin/src/commands/execution.rs b/crates/bevy_plugin/src/commands/execution.rs index 0052bfd3..5ae91e97 100644 --- a/crates/bevy_plugin/src/commands/execution.rs +++ b/crates/bevy_plugin/src/commands/execution.rs @@ -14,8 +14,8 @@ pub(crate) fn command_execution_plugin(app: &mut App) { ); } -fn execute_commands(world: &mut World, mut reader: Local>) { - let events = clone_events(world, &mut reader); +fn execute_commands(world: &mut World, mut cursor: Local>) { + let events = clone_events(world, &mut cursor); for event in events { let Some(mut command) = clone_command(world, &event) else { continue; @@ -30,10 +30,10 @@ fn execute_commands(world: &mut World, mut reader: Local, + cursor: &mut EventCursor, ) -> Vec { let events = world.resource::>(); - reader.read(events).cloned().collect() + cursor.read(events).cloned().collect() } fn clone_command( diff --git a/crates/bevy_plugin/src/dialogue_runner/inner.rs b/crates/bevy_plugin/src/dialogue_runner/inner.rs index c393b0ce..94b68fec 100644 --- a/crates/bevy_plugin/src/dialogue_runner/inner.rs +++ b/crates/bevy_plugin/src/dialogue_runner/inner.rs @@ -13,7 +13,7 @@ pub struct InnerDialogue<'a>(pub(crate) &'a Dialogue); #[derive(Debug)] pub struct InnerDialogueMut<'a>(pub(crate) &'a mut Dialogue); -impl<'a> InnerDialogue<'a> { +impl InnerDialogue<'_> { /// Proxy for [`Dialogue::node_names`]. pub fn node_names(&self) -> impl Iterator { self.0.node_names().unwrap() @@ -33,7 +33,7 @@ impl<'a> InnerDialogue<'a> { } } -impl<'a> InnerDialogueMut<'a> { +impl InnerDialogueMut<'_> { /// Proxy for [`Dialogue::node_names`]. pub fn node_names(&self) -> impl Iterator { self.0.node_names().unwrap() diff --git a/crates/bevy_plugin/src/line_provider/text_provider/strings_file_text_provider.rs b/crates/bevy_plugin/src/line_provider/text_provider/strings_file_text_provider.rs index 96c90f66..c42b66cb 100644 --- a/crates/bevy_plugin/src/line_provider/text_provider/strings_file_text_provider.rs +++ b/crates/bevy_plugin/src/line_provider/text_provider/strings_file_text_provider.rs @@ -23,7 +23,7 @@ pub struct StringsFileTextProvider { base_string_table: HashMap, strings_file_handle: Option>, translation_string_table: Option>, - event_reader: Arc>>>, + event_cursor: Arc>>>, } impl UnderlyingTextProvider for StringsFileTextProvider { @@ -115,7 +115,7 @@ impl StringsFileTextProvider { base_string_table: yarn_project.compilation.string_table.clone(), strings_file_handle: None, translation_string_table: None, - event_reader: Default::default(), + event_cursor: Default::default(), } } fn set_language_invalidating_translation(&mut self, language: impl Into>) { @@ -158,8 +158,8 @@ impl TextProvider for StringsFileTextProvider { } let asset_events = world.resource::>>(); let strings_file_has_changed = || { - let mut reader = self.event_reader.write().unwrap(); - reader.read(asset_events).any(|event| match event { + let mut cursor = self.event_cursor.write().unwrap(); + cursor.read(asset_events).any(|event| match event { AssetEvent::Modified { id } => *id == handle.id(), _ => false, }) diff --git a/crates/bevy_plugin/src/localization/strings_file/asset.rs b/crates/bevy_plugin/src/localization/strings_file/asset.rs index 4619d9ae..e741fd3e 100644 --- a/crates/bevy_plugin/src/localization/strings_file/asset.rs +++ b/crates/bevy_plugin/src/localization/strings_file/asset.rs @@ -2,7 +2,7 @@ use crate::prelude::*; use anyhow::{anyhow, bail}; -use bevy::asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext}; +use bevy::asset::{io::Reader, AssetLoader, LoadContext}; use bevy::prelude::*; use bevy::reflect::TypePath; use bevy::utils::HashMap; @@ -27,7 +27,7 @@ impl AssetLoader for StringsFileAssetLoader { &self, reader: &mut dyn Reader, _settings: &(), - load_context: &mut LoadContext<'_>, + _load_context: &mut LoadContext<'_>, ) -> Result { let mut bytes = Vec::new(); reader.read_to_end(&mut bytes).await?; diff --git a/crates/bevy_plugin/src/plugin/yarn_file_source.rs b/crates/bevy_plugin/src/plugin/yarn_file_source.rs index e9edfc02..0276ec4b 100644 --- a/crates/bevy_plugin/src/plugin/yarn_file_source.rs +++ b/crates/bevy_plugin/src/plugin/yarn_file_source.rs @@ -2,7 +2,7 @@ use crate::plugin::AssetRoot; use crate::prelude::*; #[cfg(not(any(target_arch = "wasm32", target_os = "android")))] use anyhow::ensure; -use bevy::{prelude::*, reflect::TypePath}; +use bevy::prelude::*; #[cfg(not(any(target_arch = "wasm32", target_os = "android")))] use glob::glob; use std::path::PathBuf; diff --git a/crates/bevy_plugin/src/yarn_file_asset.rs b/crates/bevy_plugin/src/yarn_file_asset.rs index a28ad8cd..adfdcd1e 100644 --- a/crates/bevy_plugin/src/yarn_file_asset.rs +++ b/crates/bevy_plugin/src/yarn_file_asset.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use bevy::asset::{io::Reader, AsyncReadExt}; +use bevy::asset::io::Reader; use bevy::prelude::*; use bevy::asset::{AssetLoader, LoadContext}; diff --git a/crates/bevy_plugin/tests/utils/assertion.rs b/crates/bevy_plugin/tests/utils/assertion.rs index 270e6f36..9d77ac1b 100644 --- a/crates/bevy_plugin/tests/utils/assertion.rs +++ b/crates/bevy_plugin/tests/utils/assertion.rs @@ -4,14 +4,14 @@ use bevy_yarnspinner::events::*; #[derive(Debug, Default)] pub struct EventAsserter { - pub present_line_reader: EventCursor, - pub present_options_reader: EventCursor, - pub dialogue_start_reader: EventCursor, - pub dialogue_complete_reader: EventCursor, - pub node_start_reader: EventCursor, - pub node_complete_reader: EventCursor, - pub line_hints_reader: EventCursor, - pub execute_command_reader: EventCursor, + pub present_line_cursor: EventCursor, + pub present_options_cursor: EventCursor, + pub dialogue_start_cursor: EventCursor, + pub dialogue_complete_cursor: EventCursor, + pub node_start_cursor: EventCursor, + pub node_complete_cursor: EventCursor, + pub line_hints_cursor: EventCursor, + pub execute_command_cursor: EventCursor, } impl EventAsserter { @@ -20,50 +20,50 @@ impl EventAsserter { } pub fn clear_events(&mut self, app: &mut App) { - self.present_line_reader + self.present_line_cursor .clear(app.world().resource::>()); - self.present_options_reader + self.present_options_cursor .clear(app.world().resource::>()); - self.dialogue_start_reader + self.dialogue_start_cursor .clear(app.world().resource::>()); - self.dialogue_complete_reader + self.dialogue_complete_cursor .clear(app.world().resource::>()); - self.node_start_reader + self.node_start_cursor .clear(app.world().resource::>()); - self.node_complete_reader + self.node_complete_cursor .clear(app.world().resource::>()); - self.line_hints_reader + self.line_hints_cursor .clear(app.world().resource::>()); - self.execute_command_reader + self.execute_command_cursor .clear(app.world().resource::>()); } } #[macro_export] -macro_rules! get_reader { +macro_rules! get_cursor { ($asserter:ident, PresentLineEvent) => { - &mut $asserter.present_line_reader + &mut $asserter.present_line_cursor }; ($asserter:ident, PresentOptionsEvent) => { - &mut $asserter.present_options_reader + &mut $asserter.present_options_cursor }; ($asserter:ident, DialogueStartEvent) => { - &mut $asserter.dialogue_start_reader + &mut $asserter.dialogue_start_cursor }; ($asserter:ident, DialogueCompleteEvent) => { - &mut $asserter.dialogue_complete_reader + &mut $asserter.dialogue_complete_cursor }; ($asserter:ident, NodeStartEvent) => { - &mut $asserter.node_start_reader + &mut $asserter.node_start_cursor }; ($asserter:ident, NodeCompleteEvent) => { - &mut $asserter.node_complete_reader + &mut $asserter.node_complete_cursor }; ($asserter:ident, LineHintsEvent) => { - &mut $asserter.line_hints_reader + &mut $asserter.line_hints_cursor }; ($asserter:ident, ExecuteCommandEvent) => { - &mut $asserter.execute_command_reader + &mut $asserter.execute_command_cursor }; } @@ -79,8 +79,8 @@ macro_rules! assert_events { }; ($asserter:ident, $app:ident contains $event:ident (n = $num:expr) $(with $pred:expr)?) => { let events = $app.world().resource::>(); - let reader = $crate::get_reader!($asserter, $event); - let events: Vec<&$event> = reader.read(&events).collect(); + let cursor = $crate::get_cursor!($asserter, $event); + let events: Vec<&$event> = cursor.read(&events).collect(); assert_eq!($num, events.len(), "Expected {} events of type {}, but found {}: {events:#?}", stringify!($num), stringify!($event), events.len()); $( { diff --git a/crates/compiler/src/listeners/compiler_listener/emit.rs b/crates/compiler/src/listeners/compiler_listener/emit.rs index f1647ce3..d1a37182 100644 --- a/crates/compiler/src/listeners/compiler_listener/emit.rs +++ b/crates/compiler/src/listeners/compiler_listener/emit.rs @@ -4,7 +4,7 @@ use antlr_rust::token::Token; use yarnspinner_core::prelude::OpCode; use yarnspinner_core::prelude::*; -impl<'input> CompilerListener<'input> { +impl CompilerListener<'_> { /// Creates a new instruction, and appends it to a node in the [`Program`]. pub(crate) fn emit(&mut self, emit: Emit) { let instruction = Instruction { diff --git a/crates/compiler/src/listeners/error_listener.rs b/crates/compiler/src/listeners/error_listener.rs index 84901934..27cd7aec 100644 --- a/crates/compiler/src/listeners/error_listener.rs +++ b/crates/compiler/src/listeners/error_listener.rs @@ -143,5 +143,5 @@ impl<'input, T: Recognizer<'input>> ErrorListener<'input, T> for ParserErrorList } } -impl<'input> ParseTreeListener<'input, YarnSpinnerParserContextType> for ParserErrorListener {} -impl<'input> YarnSpinnerParserListener<'input> for ParserErrorListener {} +impl ParseTreeListener<'_, YarnSpinnerParserContextType> for ParserErrorListener {} +impl YarnSpinnerParserListener<'_> for ParserErrorListener {} diff --git a/crates/compiler/src/visitors/last_line_before_options_visitor.rs b/crates/compiler/src/visitors/last_line_before_options_visitor.rs index 88453400..d9305272 100644 --- a/crates/compiler/src/visitors/last_line_before_options_visitor.rs +++ b/crates/compiler/src/visitors/last_line_before_options_visitor.rs @@ -11,7 +11,7 @@ pub(crate) struct LastLineBeforeOptionsVisitor { _dummy: (), } -impl<'input> ParseTreeVisitorCompat<'input> for LastLineBeforeOptionsVisitor { +impl ParseTreeVisitorCompat<'_> for LastLineBeforeOptionsVisitor { type Node = YarnSpinnerParserContextType; type Return = (); diff --git a/crates/compiler/src/visitors/node_tracking_visitor.rs b/crates/compiler/src/visitors/node_tracking_visitor.rs index d0282ebc..4e49d079 100644 --- a/crates/compiler/src/visitors/node_tracking_visitor.rs +++ b/crates/compiler/src/visitors/node_tracking_visitor.rs @@ -18,7 +18,7 @@ impl NodeTrackingVisitor { } } -impl<'input> ParseTreeVisitorCompat<'input> for NodeTrackingVisitor { +impl ParseTreeVisitorCompat<'_> for NodeTrackingVisitor { type Node = YarnSpinnerParserContextType; type Return = Option; diff --git a/crates/core/src/yarn_fn/parameter_wrapping.rs b/crates/core/src/yarn_fn/parameter_wrapping.rs index 6c443fee..8b34ca9f 100644 --- a/crates/core/src/yarn_fn/parameter_wrapping.rs +++ b/crates/core/src/yarn_fn/parameter_wrapping.rs @@ -112,7 +112,7 @@ where phantom_data: PhantomData, } -impl<'res, T> YarnFnParam for ResRef<'res, T> +impl YarnFnParam for ResRef<'_, T> where T: TryFrom + 'static, >::Error: Display, @@ -145,7 +145,7 @@ where phantom_data: PhantomData, } -impl<'res, T, U> YarnFnParam for ResRefBorrow<'res, T, U> +impl YarnFnParam for ResRefBorrow<'_, T, U> where T: TryFrom + 'static, >::Error: Display, diff --git a/crates/example_dialogue_view/src/option_selection.rs b/crates/example_dialogue_view/src/option_selection.rs index 93b48704..e8487578 100644 --- a/crates/example_dialogue_view/src/option_selection.rs +++ b/crates/example_dialogue_view/src/option_selection.rs @@ -52,8 +52,8 @@ fn create_options( mut options_node: Query<(Entity, &mut Node, &mut Visibility), With>, mut root_visibility: Query<&mut Visibility, (With, Without)>, ) { - let (entity, mut style, mut visibility) = options_node.single_mut(); - style.display = Display::Flex; + let (entity, mut node, mut visibility) = options_node.single_mut(); + node.display = Display::Flex; *visibility = Visibility::Hidden; if children.iter_descendants(entity).next().is_none() { *root_visibility.single_mut() = Visibility::Inherited; @@ -149,9 +149,9 @@ fn despawn_options( has_selected_option_event.clear(); dialogue_complete_event.clear(); commands.remove_resource::(); - let (entity, mut style, mut visibility) = options_node.single_mut(); + let (entity, mut node, mut visibility) = options_node.single_mut(); commands.entity(entity).despawn_descendants(); - style.display = Display::None; + node.display = Display::None; *visibility = Visibility::Hidden; *dialogue_node_text.single_mut() = Text::default(); *root_visibility.single_mut() = Visibility::Hidden; diff --git a/crates/example_dialogue_view/src/setup.rs b/crates/example_dialogue_view/src/setup.rs index 87443de2..f4f17a6b 100644 --- a/crates/example_dialogue_view/src/setup.rs +++ b/crates/example_dialogue_view/src/setup.rs @@ -55,7 +55,7 @@ fn setup(mut commands: Commands) { .with_children(|parent| { parent.spawn(( fmt_name("name"), - Text::new(String::new()), + Text::default(), text_style::name(), Node { margin: UiRect { @@ -92,7 +92,7 @@ fn setup(mut commands: Commands) { // Dialog itself parent.spawn(( fmt_name("text"), - Text(String::new()), + Text::default(), text_style::standard(), style::standard(), DialogueNode, @@ -192,7 +192,7 @@ where parent .spawn(( fmt_name("option text"), - Text(String::new()), + Text::default(), style::options(), Label, )) diff --git a/examples/bevy_yarnspinner/src/bin/access_variables.rs b/examples/bevy_yarnspinner/src/bin/access_variables.rs index 7bc731ac..094598d7 100644 --- a/examples/bevy_yarnspinner/src/bin/access_variables.rs +++ b/examples/bevy_yarnspinner/src/bin/access_variables.rs @@ -22,7 +22,7 @@ fn main() { } fn setup_camera(mut commands: Commands) { - commands.spawn(Camera2d::default()); + commands.spawn(Camera2d); } fn spawn_dialogue_runner(mut commands: Commands, project: Res) { diff --git a/examples/bevy_yarnspinner/src/bin/custom_command.rs b/examples/bevy_yarnspinner/src/bin/custom_command.rs index 7c4dc68f..bc862ed7 100644 --- a/examples/bevy_yarnspinner/src/bin/custom_command.rs +++ b/examples/bevy_yarnspinner/src/bin/custom_command.rs @@ -19,7 +19,7 @@ fn main() { } fn setup_camera(mut commands: Commands) { - commands.spawn(Camera2d::default()); + commands.spawn(Camera2d); } fn spawn_dialogue_runner(mut commands: Commands, project: Res) { diff --git a/examples/bevy_yarnspinner/src/bin/custom_function.rs b/examples/bevy_yarnspinner/src/bin/custom_function.rs index d8cbabbb..bc120ae4 100644 --- a/examples/bevy_yarnspinner/src/bin/custom_function.rs +++ b/examples/bevy_yarnspinner/src/bin/custom_function.rs @@ -19,7 +19,7 @@ fn main() { } fn setup_camera(mut commands: Commands) { - commands.spawn(Camera2d::default()); + commands.spawn(Camera2d); } fn spawn_dialogue_runner(mut commands: Commands, project: Res) { diff --git a/examples/bevy_yarnspinner/src/bin/hello_world.rs b/examples/bevy_yarnspinner/src/bin/hello_world.rs index 0a5f7713..30ec1652 100644 --- a/examples/bevy_yarnspinner/src/bin/hello_world.rs +++ b/examples/bevy_yarnspinner/src/bin/hello_world.rs @@ -23,7 +23,7 @@ fn main() { } fn setup_camera(mut commands: Commands) { - commands.spawn(Camera2d::default()); + commands.spawn(Camera2d); } fn spawn_dialogue_runner(mut commands: Commands, project: Res) { diff --git a/examples/yarnspinner_without_bevy/src/widgets.rs b/examples/yarnspinner_without_bevy/src/widgets.rs index 223f6b9d..86f3761d 100644 --- a/examples/yarnspinner_without_bevy/src/widgets.rs +++ b/examples/yarnspinner_without_bevy/src/widgets.rs @@ -21,7 +21,7 @@ impl<'a> LineView<'a> { } } -impl<'a> Widget for LineView<'a> { +impl Widget for LineView<'_> { fn render(self, area: Rect, buf: &mut Buffer) { Paragraph::new(self.line.text_without_character_name().as_str()) .style(self.style)