Skip to content

Commit cd8dccb

Browse files
authored
Fix cyclic dep (#11523)
# Objective Rust analyzer kept complaining about a cyclic dependency due to `bevy_input` having a dev-dependency on `bevy`. `bevy_input` was also missing `bevy_reflect`'s "smol_str" feature which it needs to compile on its own. Fixes #10256 ## Solution Remove the dev-dependency on `bevy` from `bevy_input` since it was only used to reduce imports for 1 test and 3 doc examples by 1 line each, as `bevy_input` already has dependencies on everything needed for those tests and doctests to work. Add `bevy_reflect`'s "smol_str" feature to `bevy_input`'s dependency list as it needs it to actually compile.
1 parent 2922476 commit cd8dccb

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

crates/bevy_input/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ bevy_math = { path = "../bevy_math", version = "0.12.0" }
2020
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
2121
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
2222
"glam",
23+
"smol_str",
2324
] }
2425

2526
# other
2627
serde = { version = "1", features = ["derive"], optional = true }
2728
thiserror = "1.0"
2829
smol_str = "0.2"
2930

30-
[dev-dependencies]
31-
bevy = { path = "../../", version = "0.12.0" }
32-
3331
[lints]
3432
workspace = true

crates/bevy_input/src/common_conditions.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use std::hash::Hash;
55
/// Stateful run condition that can be toggled via a input press using [`ButtonInput::just_pressed`].
66
///
77
/// ```no_run
8-
/// use bevy::prelude::*;
9-
/// use bevy::input::common_conditions::input_toggle_active;
8+
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update};
9+
/// # use bevy_ecs::prelude::IntoSystemConfigs;
10+
/// # use bevy_input::{common_conditions::input_toggle_active, prelude::KeyCode};
1011
///
1112
/// fn main() {
1213
/// App::new()
@@ -23,8 +24,9 @@ use std::hash::Hash;
2324
/// If you want other systems to be able to access whether the toggled state is active,
2425
/// you should use a custom resource or a state for that:
2526
/// ```no_run
26-
/// use bevy::prelude::*;
27-
/// use bevy::input::common_conditions::input_just_pressed;
27+
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update};
28+
/// # use bevy_ecs::prelude::{IntoSystemConfigs, Res, ResMut, Resource};
29+
/// # use bevy_input::{common_conditions::input_just_pressed, prelude::KeyCode};
2830
///
2931
/// #[derive(Resource, Default)]
3032
/// struct Paused(bool);
@@ -72,8 +74,9 @@ where
7274
/// Run condition that is active if [`ButtonInput::just_pressed`] is true for the given input.
7375
///
7476
/// ```no_run
75-
/// use bevy::prelude::*;
76-
/// use bevy::input::common_conditions::input_just_pressed;
77+
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update};
78+
/// # use bevy_ecs::prelude::IntoSystemConfigs;
79+
/// # use bevy_input::{common_conditions::input_just_pressed, prelude::KeyCode};
7780
/// fn main() {
7881
/// App::new()
7982
/// .add_plugins(DefaultPlugins)
@@ -101,7 +104,8 @@ where
101104
#[cfg(test)]
102105
mod tests {
103106
use super::*;
104-
use bevy::prelude::{IntoSystemConfigs, KeyCode, Schedule};
107+
use crate::prelude::KeyCode;
108+
use bevy_ecs::schedule::{IntoSystemConfigs, Schedule};
105109

106110
fn test_system() {}
107111

0 commit comments

Comments
 (0)