Make clippy happy

main
Elijah Voigt 3 months ago
parent c24dabde16
commit 145008a52d

@ -774,8 +774,9 @@ fn drag_tree(
camera: Single<(&Camera, &GlobalTransform), With<Camera>>, camera: Single<(&Camera, &GlobalTransform), With<Camera>>,
window: Single<&Window>, window: Single<&Window>,
) { ) {
if *state.get() == DebuggingState::On { if *state.get() == DebuggingState::On
if let Ok(mut t) = query.get_mut(trigger.target()) { && let Ok(mut t) = query.get_mut(trigger.target())
{
let world_position = window let world_position = window
.cursor_position() .cursor_position()
.and_then(|cursor| camera.0.viewport_to_world(camera.1, cursor).ok()) .and_then(|cursor| camera.0.viewport_to_world(camera.1, cursor).ok())
@ -788,12 +789,11 @@ fn drag_tree(
}); });
t.translation = world_position.unwrap(); t.translation = world_position.unwrap();
} }
}
} }
// When you pointer over the '+' make the entire menu visible // When you pointer over the '+' make the entire menu visible
fn hide_menu(mut nodes: Query<(Entity, &mut Visibility, &NavState), Changed<NavState>>) { fn hide_menu(mut nodes: Query<(&mut Visibility, &NavState), Changed<NavState>>) {
nodes.iter_mut().for_each(|(e, mut v, n)| { nodes.iter_mut().for_each(|(mut v, n)| {
*v = match n { *v = match n {
NavState::Open => Visibility::Inherited, NavState::Open => Visibility::Inherited,
NavState::Closed => Visibility::Hidden, NavState::Closed => Visibility::Hidden,

@ -46,9 +46,9 @@ impl From<String> for MonologueLine {
} }
} }
impl Into<String> for MonologueLine { impl From<MonologueLine> for String {
fn into(self) -> String { fn from(val: MonologueLine) -> Self {
self.value val.value
} }
} }

@ -72,9 +72,7 @@ fn init_debug_ui(mut commands: Commands) {
DebuggingState::On, DebuggingState::On,
Name::new("Debug Indicator"), Name::new("Debug Indicator"),
GlobalZIndex(i32::MAX - 1), GlobalZIndex(i32::MAX - 1),
children![ children![Text(" Debug: ON ".into()),],
Text(" Debug: ON ".into()),
],
Node { Node {
align_self: AlignSelf::Center, align_self: AlignSelf::Center,
justify_self: JustifySelf::End, justify_self: JustifySelf::End,
@ -86,9 +84,7 @@ fn init_debug_ui(mut commands: Commands) {
commands.spawn(( commands.spawn((
DebuggingState::On, DebuggingState::On,
Name::new("Version #"), Name::new("Version #"),
children![ children![Text::new(VERSION),],
Text::new(VERSION),
],
GlobalZIndex(i32::MAX - 1), GlobalZIndex(i32::MAX - 1),
Node { Node {
width: Val::Auto, width: Val::Auto,
@ -99,7 +95,8 @@ fn init_debug_ui(mut commands: Commands) {
)); ));
// Version string for troubleshooting // Version string for troubleshooting
commands.spawn(( commands
.spawn((
DebuggingState::On, DebuggingState::On,
Name::new("FPS"), Name::new("FPS"),
GlobalZIndex(i32::MAX - 1), GlobalZIndex(i32::MAX - 1),
@ -109,14 +106,13 @@ fn init_debug_ui(mut commands: Commands) {
justify_self: JustifySelf::End, justify_self: JustifySelf::End,
..default() ..default()
}, },
)).with_children(|parent| { ))
parent.spawn(( .with_children(|parent| {
Text::new("FPS: ##.#"), parent.spawn((Text::new("FPS: ##.#"), SyncResource::<Fps>::default()));
SyncResource::<Fps>::default(),
));
}); });
commands.spawn(( commands
.spawn((
DebuggingState::On, DebuggingState::On,
Name::new("Entity Count"), Name::new("Entity Count"),
GlobalZIndex(i32::MAX - 1), GlobalZIndex(i32::MAX - 1),
@ -126,7 +122,8 @@ fn init_debug_ui(mut commands: Commands) {
justify_self: JustifySelf::Center, justify_self: JustifySelf::Center,
..default() ..default()
}, },
)).with_children(|parent| { ))
.with_children(|parent| {
parent.spawn(( parent.spawn((
Text::new("Entities: ###"), Text::new("Entities: ###"),
SyncResource::<EntityCount>::default(), SyncResource::<EntityCount>::default(),
@ -134,7 +131,8 @@ fn init_debug_ui(mut commands: Commands) {
}); });
// Tooltip // Tooltip
commands.spawn(( commands
.spawn((
DebuggingState::On, DebuggingState::On,
SyncResource::<ToolTip>::default(), SyncResource::<ToolTip>::default(),
Pickable::IGNORE, Pickable::IGNORE,
@ -149,7 +147,8 @@ fn init_debug_ui(mut commands: Commands) {
justify_content: JustifyContent::Center, justify_content: JustifyContent::Center,
..default() ..default()
}, },
)).with_children(|parent| { ))
.with_children(|parent| {
parent.spawn(( parent.spawn((
Text("Tooltip Placeholder".into()), Text("Tooltip Placeholder".into()),
SyncResource::<ToolTip>::default(), SyncResource::<ToolTip>::default(),

@ -14,7 +14,7 @@ impl Plugin for BaseUiPlugin {
add_ui_text add_ui_text
.run_if(any_component_added::<Text>) .run_if(any_component_added::<Text>)
.after(add_ui_node), .after(add_ui_node),
navs_on_top.run_if(any_component_changed::<NavState>) navs_on_top.run_if(any_component_changed::<NavState>),
), ),
); );
} }
@ -208,18 +208,13 @@ pub enum NavState {
Closed, Closed,
} }
fn navs_on_top( fn navs_on_top(changed: Query<(Entity, &NavState), Changed<NavState>>, mut commands: Commands) {
changed: Query<(Entity, &NavState), Changed<NavState>>, changed.iter().for_each(|(e, ns)| match ns {
mut commands: Commands,
) {
changed.iter().for_each(|(e, ns)| {
match ns {
NavState::Open => { NavState::Open => {
commands.entity(e).insert(GlobalZIndex(i32::MAX/ 2)); commands.entity(e).insert(GlobalZIndex(i32::MAX / 2));
} }
NavState::Closed => { NavState::Closed => {
commands.entity(e).remove::<GlobalZIndex>(); commands.entity(e).remove::<GlobalZIndex>();
} }
}
}) })
} }

Loading…
Cancel
Save