Allows a number of clippy lints and fixes 2 (#1999)

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This commit is contained in:
Jonas Matser 2021-05-14 20:37:32 +00:00
parent cdae95b4b8
commit d1f40148fd
15 changed files with 19 additions and 11 deletions

View File

@ -124,7 +124,7 @@ pub struct BundleInfo {
impl BundleInfo {
/// # Safety
/// table row must exist, entity must be valid
#[allow(clippy::clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments)]
#[inline]
pub(crate) unsafe fn write_components<T: Bundle>(
&self,

View File

@ -119,6 +119,7 @@ where
system_state: SystemState,
config: Option<<Param::Fetch as SystemParamState>::Config>,
// NOTE: PhantomData<fn()-> T> gives this safe Send/Sync impls
#[allow(clippy::type_complexity)]
marker: PhantomData<fn() -> (In, Out, Marker)>,
}

View File

@ -227,6 +227,7 @@ pub trait FromType<T> {
#[derive(Clone)]
pub struct ReflectDeserialize {
#[allow(clippy::type_complexity)]
pub func: fn(
deserializer: &mut dyn erased_serde::Deserializer,
) -> Result<Box<dyn Reflect>, erased_serde::Error>,

View File

@ -63,6 +63,7 @@ impl Camera {
}
}
#[allow(clippy::type_complexity)]
pub fn camera_system<T: CameraProjection + Component>(
mut window_resized_events: EventReader<WindowResized>,
mut window_created_events: EventReader<WindowCreated>,

View File

@ -505,6 +505,7 @@ pub struct MeshResourceProviderState {
mesh_entities: HashMap<Handle<Mesh>, MeshEntities>,
}
#[allow(clippy::type_complexity)]
pub fn mesh_resource_provider_system(
mut state: Local<MeshResourceProviderState>,
render_resource_context: Res<Box<dyn RenderResourceContext>>,

View File

@ -52,7 +52,7 @@ impl Default for CapsuleUvProfile {
}
impl From<Capsule> for Mesh {
#[allow(clippy::clippy::needless_range_loop)]
#[allow(clippy::needless_range_loop)]
fn from(capsule: Capsule) -> Self {
// code adapted from https://behreajj.medium.com/making-a-capsule-mesh-via-script-in-five-3d-environments-c2214abf02db

View File

@ -428,6 +428,7 @@ impl<I, T: RenderResources> Default for RenderResourcesNodeState<I, T> {
}
}
#[allow(clippy::type_complexity)]
fn render_resources_node_system<T: RenderResources>(
mut state: Local<RenderResourcesNodeState<Entity, T>>,
mut entities_waiting_for_textures: Local<Vec<Entity>>,
@ -610,7 +611,7 @@ impl<T: Asset> Default for AssetRenderNodeState<T> {
}
}
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
fn asset_render_resources_node_system<T: RenderResources + Asset>(
mut state: Local<RenderResourcesNodeState<HandleId, T>>,
mut asset_state: Local<AssetRenderNodeState<T>>,

View File

@ -55,6 +55,7 @@ impl Default for WireframeConfig {
}
}
#[allow(clippy::type_complexity)]
pub fn draw_wireframes_system(
mut draw_context: DrawContext,
msaa: Res<Msaa>,

View File

@ -59,6 +59,7 @@ impl From<Handle<Texture>> for ColorMaterial {
// Temporary solution for sub-assets change handling, see https://github.com/bevyengine/bevy/issues/1161#issuecomment-780467768
// TODO: should be removed when pipelined rendering is done
#[allow(clippy::type_complexity)]
pub(crate) fn material_texture_detection_system(
mut texture_to_material: Local<HashMap<Handle<Texture>, HashSet<Handle<ColorMaterial>>>>,
mut material_to_texture: Local<HashMap<Handle<ColorMaterial>, Handle<Texture>>>,

View File

@ -57,6 +57,7 @@ impl Default for Text2dBundle {
/// System for drawing text in a 2D scene via a 2D `OrthographicCameraBundle`. Included in the
/// default `TextPlugin`. Position is determined by the `Transform`'s translation, though scale and
/// rotation are ignored.
#[allow(clippy::type_complexity)]
pub fn draw_text2d_system(
mut context: DrawContext,
msaa: Res<Msaa>,
@ -125,7 +126,7 @@ pub struct QueuedText2d {
}
/// Updates the TextGlyphs with the new computed glyphs from the layout
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
pub fn text2d_system(
mut queued_text: Local<QueuedText2d>,
mut textures: ResMut<Assets<Texture>>,

View File

@ -195,7 +195,7 @@ pub enum FlexError {
StretchError(stretch::Error),
}
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
pub fn flex_node_system(
windows: Res<Windows>,
mut scale_factor_events: EventReader<WindowScaleFactorChanged>,

View File

@ -39,6 +39,7 @@ pub struct State {
entities_to_reset: SmallVec<[Entity; 1]>,
}
#[allow(clippy::type_complexity)]
pub fn ui_focus_system(
mut state: Local<State>,
windows: Res<Windows>,

View File

@ -42,7 +42,7 @@ pub fn text_constraint(min_size: Val, size: Val, max_size: Val, scale_factor: f6
/// Computes the size of a text block and updates the TextGlyphs with the
/// new computed glyphs from the layout
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
pub fn text_system(
mut queued_text: Local<QueuedText>,
mut last_scale_factor: Local<f64>,
@ -139,7 +139,7 @@ pub fn text_system(
queued_text.entities = new_queue;
}
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
pub fn draw_text_system(
mut context: DrawContext,
msaa: Res<Msaa>,

View File

@ -146,7 +146,7 @@ impl WgpuFrom<BufferUsage> for wgpu::BufferUsage {
impl WgpuFrom<&LoadOp<Color>> for wgpu::LoadOp<wgpu::Color> {
fn from(val: &LoadOp<Color>) -> Self {
match val {
LoadOp::Clear(value) => wgpu::LoadOp::Clear(value.clone().wgpu_into()),
LoadOp::Clear(value) => wgpu::LoadOp::Clear((*value).wgpu_into()),
LoadOp::Load => wgpu::LoadOp::Load,
}
}

View File

@ -152,11 +152,10 @@ fn change_window(world: &mut World) {
width: constraints.max_width,
height: constraints.max_height,
};
window.set_min_inner_size(Some(min_inner_size));
if constraints.max_width.is_finite() && constraints.max_height.is_finite() {
window.set_min_inner_size(Some(min_inner_size));
window.set_max_inner_size(Some(max_inner_size));
} else {
window.set_min_inner_size(Some(min_inner_size));
}
}
}