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

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

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

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

Loading…
Cancel
Save