mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Remove redundant imports (#12817)
# Objective - There are several redundant imports in the tests and examples that are not caught by CI because additional flags need to be passed. ## Solution - Run `cargo check --workspace --tests` and `cargo check --workspace --examples`, then fix all warnings. - Add `test-check` to CI, which will be run in the check-compiles job. This should catch future warnings for tests. Examples are already checked, but I'm not yet sure why they weren't caught. ## Discussion - Should the `--tests` and `--examples` flags be added to CI, so this is caught in the future? - If so, #12818 will need to be merged first. It was also a warning raised by checking the examples, but I chose to split off into a separate PR. --------- Co-authored-by: François Mockers <francois.mockers@vleue.com>
This commit is contained in:
parent
abd94480ab
commit
84363f2fab
47 changed files with 56 additions and 63 deletions
|
@ -304,7 +304,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{
|
||||
color_difference::EuclideanDistance, test_colors::TEST_COLORS, testing::assert_approx_eq,
|
||||
Srgba,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -227,7 +227,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{
|
||||
color_difference::EuclideanDistance, test_colors::TEST_COLORS, testing::assert_approx_eq,
|
||||
Srgba,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -260,7 +260,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{
|
||||
color_difference::EuclideanDistance, test_colors::TEST_COLORS, testing::assert_approx_eq,
|
||||
Srgba,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -320,7 +320,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{
|
||||
color_difference::EuclideanDistance, test_colors::TEST_COLORS, testing::assert_approx_eq,
|
||||
Srgba,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -289,7 +289,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{
|
||||
color_difference::EuclideanDistance, test_colors::TEST_COLORS, testing::assert_approx_eq,
|
||||
Srgba,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -305,7 +305,7 @@ impl From<Oklaba> for Xyza {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{test_colors::TEST_COLORS, testing::assert_approx_eq, Srgba};
|
||||
use crate::{test_colors::TEST_COLORS, testing::assert_approx_eq};
|
||||
|
||||
#[test]
|
||||
fn test_to_from_srgba() {
|
||||
|
|
|
@ -344,7 +344,7 @@ impl From<Oklcha> for Xyza {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{test_colors::TEST_COLORS, testing::assert_approx_eq, Srgba};
|
||||
use crate::{test_colors::TEST_COLORS, testing::assert_approx_eq};
|
||||
|
||||
#[test]
|
||||
fn test_to_from_srgba() {
|
||||
|
|
|
@ -87,8 +87,6 @@ pub type EntityHashSet = hashbrown::HashSet<Entity, EntityHash>;
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
use bevy_reflect::Reflect;
|
||||
use static_assertions::assert_impl_all;
|
||||
|
||||
// Check that the HashMaps are Clone if the key/values are Clone
|
||||
|
|
|
@ -253,8 +253,6 @@ mod tests {
|
|||
use crate::prelude::*;
|
||||
use crate::world::FilteredEntityRef;
|
||||
|
||||
use super::QueryBuilder;
|
||||
|
||||
#[derive(Component, PartialEq, Debug)]
|
||||
struct A(usize);
|
||||
|
||||
|
|
|
@ -1032,7 +1032,7 @@ mod tests {
|
|||
use crate as bevy_ecs;
|
||||
use crate::component::Component;
|
||||
use crate::schedule::IntoSystemConfigs;
|
||||
use crate::schedule::{common_conditions::not, State, States};
|
||||
use crate::schedule::{State, States};
|
||||
use crate::system::Local;
|
||||
use crate::{change_detection::ResMut, schedule::Schedule, world::World};
|
||||
use bevy_ecs_macros::Event;
|
||||
|
|
|
@ -26,7 +26,7 @@ mod tests {
|
|||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
pub use crate as bevy_ecs;
|
||||
pub use crate::schedule::{IntoSystemSetConfigs, Schedule, SystemSet};
|
||||
pub use crate::schedule::{Schedule, SystemSet};
|
||||
pub use crate::system::{Res, ResMut};
|
||||
pub use crate::{prelude::World, system::Resource};
|
||||
|
||||
|
@ -724,7 +724,6 @@ mod tests {
|
|||
use super::*;
|
||||
// Required to make the derive macro behave
|
||||
use crate as bevy_ecs;
|
||||
use crate::event::Events;
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(Resource)]
|
||||
|
|
|
@ -828,7 +828,7 @@ impl ScheduleState {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::prelude::*;
|
||||
use crate::{schedule::ScheduleLabel, world::World};
|
||||
use crate::schedule::ScheduleLabel;
|
||||
|
||||
pub use crate as bevy_ecs;
|
||||
|
||||
|
|
|
@ -1531,9 +1531,9 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{
|
||||
self as bevy_ecs, // Necessary for the `SystemParam` Derive when used inside `bevy_ecs`.
|
||||
system::{assert_is_system, Query},
|
||||
system::assert_is_system,
|
||||
};
|
||||
use std::{cell::RefCell, marker::PhantomData};
|
||||
use std::cell::RefCell;
|
||||
|
||||
// Compile test for https://github.com/bevyengine/bevy/pull/2838.
|
||||
#[test]
|
||||
|
|
|
@ -564,7 +564,6 @@ impl approx::UlpsEq for Dir3A {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::InvalidDirectionError;
|
||||
|
||||
#[test]
|
||||
fn dir2_creation() {
|
||||
|
|
|
@ -828,7 +828,6 @@ mod tests {
|
|||
// Reference values were computed by hand and/or with external tools
|
||||
|
||||
use super::*;
|
||||
use crate::{InvalidDirectionError, Quat};
|
||||
use approx::assert_relative_eq;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -491,7 +491,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate as bevy_reflect;
|
||||
use crate::*;
|
||||
use error::AccessErrorKind;
|
||||
|
||||
#[derive(Reflect)]
|
||||
struct A {
|
||||
|
|
|
@ -937,7 +937,6 @@ impl CompressedImageFormats {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::render_asset::RenderAssetUsages;
|
||||
|
||||
#[test]
|
||||
fn image_size() {
|
||||
|
|
|
@ -222,7 +222,6 @@ mod test {
|
|||
use image::{GenericImage, Rgba};
|
||||
|
||||
use super::*;
|
||||
use crate::render_asset::RenderAssetUsages;
|
||||
|
||||
#[test]
|
||||
fn two_way_conversion() {
|
||||
|
|
|
@ -239,7 +239,6 @@ pub fn paused(time: Res<Time<Virtual>>) -> bool {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use bevy_ecs::schedule::{IntoSystemConfigs, Schedule};
|
||||
use std::time::Duration;
|
||||
|
||||
fn test_system() {}
|
||||
|
||||
|
|
|
@ -188,10 +188,9 @@ mod test {
|
|||
use bevy_math::{vec3, Vec3};
|
||||
use bevy_tasks::{ComputeTaskPool, TaskPool};
|
||||
|
||||
use crate::components::{GlobalTransform, Transform};
|
||||
use crate::systems::*;
|
||||
use crate::TransformBundle;
|
||||
use bevy_hierarchy::{BuildChildren, BuildWorldChildren, Children, Parent};
|
||||
use bevy_hierarchy::{BuildChildren, BuildWorldChildren};
|
||||
|
||||
#[test]
|
||||
fn correct_parent_removed() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! This example demonstrates how to use the `Camera::viewport_to_world` method.
|
||||
|
||||
use bevy::{math::Dir3, prelude::*};
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::f32::consts::PI;
|
|||
|
||||
use bevy::{
|
||||
color::palettes::basic::{BLUE, LIME, RED},
|
||||
pbr::{light_consts, CascadeShadowConfigBuilder, NotShadowCaster, NotShadowReceiver},
|
||||
pbr::{CascadeShadowConfigBuilder, NotShadowCaster, NotShadowReceiver},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use bevy::{
|
||||
color::palettes::css::{ORANGE, SILVER, WHITE},
|
||||
math::{cubic_splines::CubicCurve, vec3},
|
||||
math::vec3,
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
use std::f32::consts::*;
|
||||
|
||||
use bevy::{
|
||||
pbr::AmbientLight,
|
||||
prelude::*,
|
||||
render::{
|
||||
mesh::{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use std::f32::consts::*;
|
||||
|
||||
use bevy::{pbr::AmbientLight, prelude::*, render::mesh::skinning::SkinnedMesh};
|
||||
use bevy::{prelude::*, render::mesh::skinning::SkinnedMesh};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! - `App::run()` will never return on iOS and Web.
|
||||
//! - It is not possible to recreate a window after the event loop has been terminated.
|
||||
|
||||
use bevy::{prelude::*, window::WindowPlugin};
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
println!("Running Bevy App");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Implements loader for a custom asset type.
|
||||
|
||||
use bevy::{
|
||||
asset::{io::Reader, ron, AssetLoader, AsyncReadExt, LoadContext},
|
||||
asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext},
|
||||
prelude::*,
|
||||
reflect::TypePath,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! This example illustrates how to react to component change.
|
||||
|
||||
use bevy::{ecs::world::Ref, prelude::*};
|
||||
use bevy::prelude::*;
|
||||
use rand::Rng;
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -9,7 +9,7 @@ use bevy::prelude::*;
|
|||
use bevy::{
|
||||
ecs::{
|
||||
component::{ComponentDescriptor, ComponentId, ComponentInfo, StorageType},
|
||||
query::{QueryBuilder, QueryData},
|
||||
query::QueryData,
|
||||
world::FilteredEntityMut,
|
||||
},
|
||||
ptr::{Aligned, OwningPtr},
|
||||
|
|
|
@ -4,7 +4,6 @@ use std::f32::consts::{FRAC_PI_2, PI};
|
|||
|
||||
use bevy::{
|
||||
color::palettes::css::{DARK_CYAN, GOLD, GRAY, PURPLE},
|
||||
gizmos::light::{LightGizmoColor, LightGizmoConfigGroup},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Prints out all chars as they are inputted.
|
||||
|
||||
use bevy::{prelude::*, window::ReceivedCharacter};
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Shows handling of gamepad input, connections, and disconnections.
|
||||
|
||||
use bevy::{input::gamepad::GamepadButton, prelude::*};
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
|
|
@ -14,7 +14,6 @@ use bevy::{
|
|||
renderer::{RenderContext, RenderDevice},
|
||||
Render, RenderApp, RenderSet,
|
||||
},
|
||||
window::WindowPlugin,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@ use std::time::Duration;
|
|||
|
||||
use bevy::{
|
||||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||
math::Quat,
|
||||
prelude::*,
|
||||
render::camera::Camera,
|
||||
window::{PresentMode, WindowResolution},
|
||||
winit::{UpdateMode, WinitSettings},
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ use bevy::{
|
|||
color::palettes::css::ORANGE_RED,
|
||||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||
prelude::*,
|
||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||
window::{PresentMode, WindowResolution},
|
||||
winit::{UpdateMode, WinitSettings},
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use bevy::{
|
|||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||
prelude::*,
|
||||
text::{BreakLineOn, Text2dBounds},
|
||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||
window::{PresentMode, WindowResolution},
|
||||
winit::{UpdateMode, WinitSettings},
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use bevy::{
|
|||
pbr::{ExtractedPointLight, GlobalLightMeta},
|
||||
prelude::*,
|
||||
render::{camera::ScalingMode, Render, RenderApp, RenderSet},
|
||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||
window::{PresentMode, WindowResolution},
|
||||
winit::{UpdateMode, WinitSettings},
|
||||
};
|
||||
use rand::{thread_rng, Rng};
|
||||
|
|
|
@ -11,7 +11,7 @@ use bevy::{
|
|||
color::palettes::css::*,
|
||||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||
prelude::*,
|
||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||
window::{PresentMode, WindowResolution},
|
||||
winit::{UpdateMode, WinitSettings},
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use bevy::{
|
|||
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
|
||||
prelude::*,
|
||||
text::{BreakLineOn, Text2dBounds},
|
||||
window::{PresentMode, WindowPlugin, WindowResolution},
|
||||
window::{PresentMode, WindowResolution},
|
||||
winit::{UpdateMode, WinitSettings},
|
||||
};
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
use std::f32::consts::PI;
|
||||
|
||||
use bevy::{
|
||||
input::gamepad::{
|
||||
GamepadAxisChangedEvent, GamepadButton, GamepadButtonChangedEvent, GamepadSettings,
|
||||
},
|
||||
input::gamepad::{GamepadAxisChangedEvent, GamepadButtonChangedEvent, GamepadSettings},
|
||||
prelude::*,
|
||||
sprite::{Anchor, MaterialMesh2dBundle, Mesh2dHandle},
|
||||
};
|
||||
|
|
|
@ -11,7 +11,6 @@ use bevy::{
|
|||
math::Vec3A,
|
||||
prelude::*,
|
||||
render::primitives::{Aabb, Sphere},
|
||||
window::WindowPlugin,
|
||||
};
|
||||
|
||||
#[path = "../../helpers/camera_controller.rs"]
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
//! This example shows how to align the orientations of objects in 3D space along two axes using the `Transform::align` API.
|
||||
|
||||
use bevy::color::{
|
||||
palettes::basic::{GRAY, RED, WHITE},
|
||||
Color,
|
||||
};
|
||||
use bevy::input::mouse::{MouseButton, MouseButtonInput, MouseMotion};
|
||||
use bevy::color::palettes::basic::{GRAY, RED, WHITE};
|
||||
use bevy::input::mouse::{MouseButtonInput, MouseMotion};
|
||||
use bevy::prelude::*;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use rand_chacha::ChaCha8Rng;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//! Shows various text layout options.
|
||||
|
||||
use bevy::{
|
||||
color::palettes::{basic::RED, css::*},
|
||||
color::palettes::css::*,
|
||||
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
|
||||
prelude::*,
|
||||
window::{PresentMode, WindowPlugin},
|
||||
window::PresentMode,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use bevy::{
|
||||
prelude::*,
|
||||
utils::Duration,
|
||||
window::{PresentMode, RequestRedraw, WindowPlugin},
|
||||
window::{PresentMode, RequestRedraw},
|
||||
winit::WinitSettings,
|
||||
};
|
||||
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
//! [documentation](https://docs.rs/bevy/latest/bevy/prelude/struct.Window.html#structfield.transparent)
|
||||
//! for more details.
|
||||
|
||||
use bevy::prelude::*;
|
||||
#[cfg(target_os = "macos")]
|
||||
use bevy::window::CompositeAlphaMode;
|
||||
use bevy::{
|
||||
prelude::*,
|
||||
window::{Window, WindowPlugin},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use bevy::{ecs::event::Events, prelude::*};
|
||||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Component, Default)]
|
||||
struct Enemy {
|
||||
|
|
|
@ -18,6 +18,7 @@ bitflags! {
|
|||
const EXAMPLE_CHECK = 0b10000000;
|
||||
const COMPILE_CHECK = 0b100000000;
|
||||
const CFG_CHECK = 0b1000000000;
|
||||
const TEST_CHECK = 0b10000000000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,13 +57,18 @@ fn main() {
|
|||
("doc", Check::DOC_TEST | Check::DOC_CHECK),
|
||||
(
|
||||
"compile",
|
||||
Check::COMPILE_FAIL | Check::BENCH_CHECK | Check::EXAMPLE_CHECK | Check::COMPILE_CHECK,
|
||||
Check::COMPILE_FAIL
|
||||
| Check::BENCH_CHECK
|
||||
| Check::EXAMPLE_CHECK
|
||||
| Check::COMPILE_CHECK
|
||||
| Check::TEST_CHECK,
|
||||
),
|
||||
("format", Check::FORMAT),
|
||||
("clippy", Check::CLIPPY),
|
||||
("compile-fail", Check::COMPILE_FAIL),
|
||||
("bench-check", Check::BENCH_CHECK),
|
||||
("example-check", Check::EXAMPLE_CHECK),
|
||||
("test-check", Check::TEST_CHECK),
|
||||
("cfg-check", Check::CFG_CHECK),
|
||||
("doc-check", Check::DOC_CHECK),
|
||||
("doc-test", Check::DOC_TEST),
|
||||
|
@ -314,6 +320,24 @@ fn main() {
|
|||
);
|
||||
}
|
||||
|
||||
if checks.contains(Check::TEST_CHECK) {
|
||||
let mut args = vec!["--workspace", "--tests"];
|
||||
|
||||
if flags.contains(Flag::KEEP_GOING) {
|
||||
args.push("--keep-going");
|
||||
}
|
||||
|
||||
test_suite.insert(
|
||||
Check::TEST_CHECK,
|
||||
vec![CITest {
|
||||
command: cmd!(sh, "cargo check {args...}"),
|
||||
failure_message: "Please fix compiler examples for tests in output above.",
|
||||
subdir: None,
|
||||
env_vars: Vec::new(),
|
||||
}],
|
||||
);
|
||||
}
|
||||
|
||||
// Actually run the tests:
|
||||
|
||||
let mut failed_checks: Check = Check::empty();
|
||||
|
|
Loading…
Reference in a new issue