mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
fixed clippy warnings
This commit is contained in:
@@ -36,6 +36,7 @@ use fyrox_core::algebra::{Quaternion, UnitQuaternion};
|
||||
/// The kind of track output value, the animation system works only with numeric properties and the number
|
||||
/// of variants is small.
|
||||
#[derive(Clone, Copy, Debug, Visit, Reflect, PartialEq, Eq)]
|
||||
#[derive(Default)]
|
||||
pub enum TrackValueKind {
|
||||
/// A real number. Requires only 1 parametric curve.
|
||||
Real,
|
||||
@@ -44,6 +45,7 @@ pub enum TrackValueKind {
|
||||
Vector2,
|
||||
|
||||
/// A 3-dimensional vector of real values. Requires 3 parametric curves, where `X = 0`, `Y = 1`, `Z = 2`.
|
||||
#[default]
|
||||
Vector3,
|
||||
|
||||
/// A 4-dimensional vector of real values. Requires 4 parametric curves, where `X = 0`, `Y = 1`, `Z = 2`, `W = 3`.
|
||||
@@ -77,11 +79,6 @@ impl TrackValueKind {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TrackValueKind {
|
||||
fn default() -> Self {
|
||||
Self::Vector3
|
||||
}
|
||||
}
|
||||
|
||||
/// Interpolation mode for track data.
|
||||
#[derive(Visit, Reflect, Debug, Clone, Default, PartialEq)]
|
||||
|
||||
@@ -47,12 +47,14 @@ impl<T: PartialEq + Clone + Visit + Reflect> SpriteSheetTexture for T {}
|
||||
|
||||
/// Animation playback status.
|
||||
#[derive(Visit, Reflect, Copy, Clone, Eq, PartialEq, Debug, AsRefStr, EnumString, VariantNames)]
|
||||
#[derive(Default)]
|
||||
pub enum Status {
|
||||
/// Animation is playing.
|
||||
Playing,
|
||||
|
||||
/// Animation is stopped. Stopped animation is guaranteed to be either at beginning or at end frames (depending on speed).
|
||||
/// When an animation is stopped manually via ([`SpriteSheetAnimation::stop()`], the animation will be rewound to beginning.
|
||||
#[default]
|
||||
Stopped,
|
||||
|
||||
/// Animation is paused. Playback can be resumed by [`SpriteSheetAnimation::play()`].
|
||||
@@ -61,11 +63,6 @@ pub enum Status {
|
||||
|
||||
uuid_provider!(Status = "74a31122-a7a8-476c-ab87-77e53cf0523c");
|
||||
|
||||
impl Default for Status {
|
||||
fn default() -> Self {
|
||||
Self::Stopped
|
||||
}
|
||||
}
|
||||
|
||||
/// Some animation event.
|
||||
#[derive(Visit, Reflect, Clone, Debug, Eq, PartialEq)]
|
||||
|
||||
@@ -39,10 +39,12 @@ use std::{
|
||||
|
||||
/// An actual type of a property value.
|
||||
#[derive(Visit, Reflect, Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Default)]
|
||||
pub enum ValueType {
|
||||
/// `bool`
|
||||
Bool,
|
||||
/// `f32`
|
||||
#[default]
|
||||
F32,
|
||||
/// `f64`
|
||||
F64,
|
||||
@@ -192,11 +194,6 @@ impl ValueType {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ValueType {
|
||||
fn default() -> Self {
|
||||
Self::F32
|
||||
}
|
||||
}
|
||||
|
||||
/// A real value that can be produced by an animation track. Animations always operate on real numbers (`f32`) for any kind
|
||||
/// of machine numeric types (including `bool`). This is needed to be able to blend values; final blending result is then
|
||||
|
||||
@@ -249,10 +249,12 @@ impl<Pos, Ter, Pat> Deref for HashConstraintMap<Pos, Ter, Pat> {
|
||||
|
||||
/// The ways in which a cell's choice of tile can be constrained.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Default)]
|
||||
pub enum TileConstraint<T, P> {
|
||||
/// No constraint. This means that the cell is outside of the area of consideration
|
||||
/// for the autotiler, such as beyond the edge of the world. Cells with this constraint
|
||||
/// put no limits on what may be adjacent in any direction.
|
||||
#[default]
|
||||
None,
|
||||
/// A terrain is a set of possible patterns. Any pattern within the terrain may be chosen
|
||||
/// to be the pattern for this cell.
|
||||
@@ -262,11 +264,6 @@ pub enum TileConstraint<T, P> {
|
||||
Pattern(P),
|
||||
}
|
||||
|
||||
impl<T, P> Default for TileConstraint<T, P> {
|
||||
fn default() -> Self {
|
||||
Self::None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, P> Default for &TileConstraint<T, P> {
|
||||
fn default() -> Self {
|
||||
|
||||
@@ -50,20 +50,14 @@ struct Generics<T> {
|
||||
}
|
||||
|
||||
// NOTE: This enum doesn't implement copy, but `#[derive(Visit)]` still works
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Visit)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Visit, Default)]
|
||||
enum PlainEnum {
|
||||
#[default]
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
}
|
||||
|
||||
// NOTE: implementing default for `PlainEnum` is REQUIRED to derive `Visit` for `OnefTheTypes`
|
||||
impl Default for PlainEnum {
|
||||
fn default() -> Self {
|
||||
Self::A
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Visit)]
|
||||
enum OneOfTheTypes {
|
||||
NamedFields(NamedFields),
|
||||
|
||||
@@ -872,19 +872,14 @@ mod test {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Visit, PartialEq, Debug)]
|
||||
#[derive(Visit, PartialEq, Debug, Default)]
|
||||
pub enum ResourceKind {
|
||||
#[default]
|
||||
Unknown,
|
||||
Model(Model),
|
||||
Texture(Texture),
|
||||
}
|
||||
|
||||
impl Default for ResourceKind {
|
||||
fn default() -> Self {
|
||||
Self::Unknown
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Visit, PartialEq, Debug)]
|
||||
struct Resource {
|
||||
kind: ResourceKind,
|
||||
|
||||
@@ -669,6 +669,7 @@ impl Default for Model {
|
||||
EnumString,
|
||||
VariantNames,
|
||||
)]
|
||||
#[derive(Default)]
|
||||
pub enum MaterialSearchOptions {
|
||||
/// Search in specified materials directory. It is suitable for cases when
|
||||
/// your model resource use shared textures.
|
||||
@@ -684,6 +685,7 @@ pub enum MaterialSearchOptions {
|
||||
/// # Platform specific
|
||||
///
|
||||
/// Works on every platform.
|
||||
#[default]
|
||||
RecursiveUp,
|
||||
|
||||
/// Global search starting from working directory. Slowest option with a lot of ambiguities -
|
||||
@@ -707,11 +709,6 @@ pub enum MaterialSearchOptions {
|
||||
|
||||
uuid_provider!(MaterialSearchOptions = "11634aa0-cf8f-4532-a8cd-c0fa6ef804f1");
|
||||
|
||||
impl Default for MaterialSearchOptions {
|
||||
fn default() -> Self {
|
||||
Self::RecursiveUp
|
||||
}
|
||||
}
|
||||
|
||||
impl MaterialSearchOptions {
|
||||
/// A helper to create MaterialsDirectory variant.
|
||||
|
||||
@@ -57,8 +57,10 @@ pub trait VertexTrait: Copy + 'static {
|
||||
/// Data type for a vertex attribute component.
|
||||
#[derive(Reflect, Copy, Clone, PartialOrd, PartialEq, Eq, Ord, Hash, Visit, Debug)]
|
||||
#[repr(u8)]
|
||||
#[derive(Default)]
|
||||
pub enum VertexAttributeDataType {
|
||||
/// 32-bit floating-point.
|
||||
#[default]
|
||||
F32,
|
||||
/// 32-bit unsigned integer.
|
||||
U32,
|
||||
@@ -68,11 +70,6 @@ pub enum VertexAttributeDataType {
|
||||
U8,
|
||||
}
|
||||
|
||||
impl Default for VertexAttributeDataType {
|
||||
fn default() -> Self {
|
||||
Self::F32
|
||||
}
|
||||
}
|
||||
|
||||
impl VertexAttributeDataType {
|
||||
/// Returns size of data in bytes.
|
||||
@@ -89,8 +86,10 @@ impl VertexAttributeDataType {
|
||||
/// room for any custom data - it may be fit into `TexCoordN` attributes.
|
||||
#[derive(Reflect, Copy, Clone, PartialOrd, PartialEq, Eq, Ord, Hash, Visit, Debug)]
|
||||
#[repr(u32)]
|
||||
#[derive(Default)]
|
||||
pub enum VertexAttributeUsage {
|
||||
/// Vertex position. Usually `Vector2<f32>` or `Vector3<f32>`.
|
||||
#[default]
|
||||
Position = 0,
|
||||
/// Vertex normal. Usually `Vector3<f32>`, more rare `Vector3<u16>` (F16).
|
||||
Normal = 1,
|
||||
@@ -139,11 +138,6 @@ pub enum VertexAttributeUsage {
|
||||
Count,
|
||||
}
|
||||
|
||||
impl Default for VertexAttributeUsage {
|
||||
fn default() -> Self {
|
||||
Self::Position
|
||||
}
|
||||
}
|
||||
|
||||
/// Input vertex attribute descriptor used to construct layouts and feed vertex buffer.
|
||||
#[derive(Debug, Hash)]
|
||||
|
||||
@@ -67,8 +67,10 @@ use strum_macros::{AsRefStr, EnumString, VariantNames};
|
||||
Copy, Clone, Debug, Reflect, Visit, PartialEq, Eq, Hash, AsRefStr, EnumString, VariantNames,
|
||||
)]
|
||||
#[repr(u32)]
|
||||
#[derive(Default)]
|
||||
pub enum RigidBodyType {
|
||||
/// Dynamic rigid bodies can be affected by external forces.
|
||||
#[default]
|
||||
Dynamic = 0,
|
||||
/// Static rigid bodies cannot be affected by external forces.
|
||||
Static = 1,
|
||||
@@ -82,11 +84,6 @@ pub enum RigidBodyType {
|
||||
|
||||
uuid_provider!(RigidBodyType = "562d2907-1b41-483a-8ca2-12eebaff7f5d");
|
||||
|
||||
impl Default for RigidBodyType {
|
||||
fn default() -> Self {
|
||||
Self::Dynamic
|
||||
}
|
||||
}
|
||||
|
||||
impl From<dynamics::RigidBodyType> for RigidBodyType {
|
||||
fn from(s: dynamics::RigidBodyType) -> Self {
|
||||
|
||||
@@ -32,10 +32,12 @@ use crate::{
|
||||
|
||||
/// Defines exact behavior of the composite node.
|
||||
#[derive(Debug, PartialEq, Visit, Eq, Clone)]
|
||||
#[derive(Default)]
|
||||
pub enum CompositeNodeKind {
|
||||
/// `Sequence` node will execute children nodes consecutively
|
||||
/// until `Status::Failure` is returned from any descendant node. In other words `Sequence`
|
||||
/// implement AND logical function.
|
||||
#[default]
|
||||
Sequence,
|
||||
/// `Selector` node will execute children until `Status::Success`
|
||||
/// is returned from any descendant node. In other worlds `Selector` implement OR logical
|
||||
@@ -43,11 +45,6 @@ pub enum CompositeNodeKind {
|
||||
Selector,
|
||||
}
|
||||
|
||||
impl Default for CompositeNodeKind {
|
||||
fn default() -> Self {
|
||||
Self::Sequence
|
||||
}
|
||||
}
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Debug, PartialEq, Visit, Eq, Clone)]
|
||||
|
||||
@@ -95,12 +95,13 @@ where
|
||||
}
|
||||
|
||||
/// Possible variations of behavior nodes.
|
||||
#[derive(Debug, PartialEq, Visit, Eq, Clone)]
|
||||
#[derive(Debug, PartialEq, Visit, Eq, Clone, Default)]
|
||||
pub enum BehaviorNode<B>
|
||||
where
|
||||
B: Clone,
|
||||
{
|
||||
#[doc(hidden)]
|
||||
#[default]
|
||||
Unknown,
|
||||
/// Root node of the tree.
|
||||
Root(RootNode<B>),
|
||||
@@ -113,15 +114,6 @@ where
|
||||
Inverter(Inverter<B>),
|
||||
}
|
||||
|
||||
impl<B> Default for BehaviorNode<B>
|
||||
where
|
||||
B: Clone,
|
||||
{
|
||||
fn default() -> Self {
|
||||
Self::Unknown
|
||||
}
|
||||
}
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Debug, PartialEq, Visit, Clone)]
|
||||
pub struct BehaviorTree<B>
|
||||
@@ -388,8 +380,9 @@ mod test {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Visit, Clone)]
|
||||
#[derive(Debug, PartialEq, Visit, Clone, Default)]
|
||||
enum BotBehavior {
|
||||
#[default]
|
||||
None,
|
||||
Walk(WalkAction),
|
||||
OpenDoor(OpenDoorAction),
|
||||
@@ -397,12 +390,6 @@ mod test {
|
||||
CloseDoor(CloseDoorAction),
|
||||
}
|
||||
|
||||
impl Default for BotBehavior {
|
||||
fn default() -> Self {
|
||||
Self::None
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Visit)]
|
||||
struct Environment {
|
||||
// > 0 - door in front of
|
||||
|
||||
@@ -75,17 +75,14 @@ pub struct StreamingBuffer {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Default)]
|
||||
enum StreamingSource {
|
||||
#[default]
|
||||
Null,
|
||||
Decoder(Decoder),
|
||||
Raw(Box<dyn RawStreamingDataSource>),
|
||||
}
|
||||
|
||||
impl Default for StreamingSource {
|
||||
fn default() -> Self {
|
||||
Self::Null
|
||||
}
|
||||
}
|
||||
|
||||
impl StreamingSource {
|
||||
#[inline]
|
||||
|
||||
@@ -57,6 +57,7 @@ pub const SAMPLE_RATE: u32 = 44100;
|
||||
/// Distance model defines how volume of sound will decay when distance to listener changes.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Reflect, Visit, AsRefStr, EnumString, VariantNames)]
|
||||
#[repr(u32)]
|
||||
#[derive(Default)]
|
||||
pub enum DistanceModel {
|
||||
/// No distance attenuation at all.
|
||||
None = 0,
|
||||
@@ -73,6 +74,7 @@ pub enum DistanceModel {
|
||||
/// # Notes
|
||||
///
|
||||
/// This is default distance model of context.
|
||||
#[default]
|
||||
InverseDistance = 1,
|
||||
|
||||
/// Distance will decay using following formula:
|
||||
@@ -101,11 +103,6 @@ pub enum DistanceModel {
|
||||
|
||||
uuid_provider!(DistanceModel = "957f3b00-3f89-438c-b1b7-e841e8d75ba9");
|
||||
|
||||
impl Default for DistanceModel {
|
||||
fn default() -> Self {
|
||||
Self::InverseDistance
|
||||
}
|
||||
}
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Clone, Default, Debug, Visit)]
|
||||
|
||||
@@ -46,8 +46,10 @@ pub mod hrtf;
|
||||
// can be only one at a time on context.
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Debug, Clone, AsRefStr, EnumString, VariantNames, Visit, Reflect)]
|
||||
#[derive(Default)]
|
||||
pub enum Renderer {
|
||||
/// Stateless default renderer.
|
||||
#[default]
|
||||
Default,
|
||||
|
||||
/// Can be used *only* with mono sounds, stereo sounds will be rendered through
|
||||
@@ -57,11 +59,6 @@ pub enum Renderer {
|
||||
|
||||
uuid_provider!(Renderer = "13bf8432-987a-4216-b6aa-f5c0e8914a31");
|
||||
|
||||
impl Default for Renderer {
|
||||
fn default() -> Self {
|
||||
Self::Default
|
||||
}
|
||||
}
|
||||
|
||||
fn render_with_params(
|
||||
source: &mut SoundSource,
|
||||
|
||||
@@ -875,6 +875,7 @@ impl TextureResourceExtension for TextureResource {
|
||||
Eq,
|
||||
)]
|
||||
#[repr(u32)]
|
||||
#[derive(Default)]
|
||||
pub enum TextureMagnificationFilter {
|
||||
/// Returns the value of the texture element that is nearest to the center of the pixel
|
||||
/// being textured.
|
||||
@@ -882,16 +883,12 @@ pub enum TextureMagnificationFilter {
|
||||
|
||||
/// Returns the weighted average of the four texture elements that are closest to the
|
||||
/// center of the pixel being textured.
|
||||
#[default]
|
||||
Linear = 1,
|
||||
}
|
||||
|
||||
uuid_provider!(TextureMagnificationFilter = "824f5b6c-8957-42db-9ebc-ef2a5dece5ab");
|
||||
|
||||
impl Default for TextureMagnificationFilter {
|
||||
fn default() -> Self {
|
||||
Self::Linear
|
||||
}
|
||||
}
|
||||
|
||||
/// The texture minifying function is used whenever the pixel being textured maps to an area
|
||||
/// greater than one texture element.
|
||||
@@ -912,6 +909,7 @@ impl Default for TextureMagnificationFilter {
|
||||
Eq,
|
||||
)]
|
||||
#[repr(u32)]
|
||||
#[derive(Default)]
|
||||
pub enum TextureMinificationFilter {
|
||||
/// Returns the value of the texture element that is nearest to the center of the pixel
|
||||
/// being textured.
|
||||
@@ -941,6 +939,7 @@ pub enum TextureMinificationFilter {
|
||||
/// and uses the Linear criterion (a weighted average of the four texture elements that
|
||||
/// are closest to the center of the pixel) to produce a texture value from each mipmap.
|
||||
/// The final texture value is a weighted average of those two values.
|
||||
#[default]
|
||||
LinearMipMapLinear = 5,
|
||||
}
|
||||
|
||||
@@ -959,11 +958,6 @@ impl TextureMinificationFilter {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TextureMinificationFilter {
|
||||
fn default() -> Self {
|
||||
Self::LinearMipMapLinear
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines a law of texture coordinate modification.
|
||||
#[derive(
|
||||
@@ -983,9 +977,11 @@ impl Default for TextureMinificationFilter {
|
||||
Eq,
|
||||
)]
|
||||
#[repr(u32)]
|
||||
#[derive(Default)]
|
||||
pub enum TextureWrapMode {
|
||||
/// Causes the integer part of a coordinate to be ignored; GPU uses only the fractional part,
|
||||
/// thereby creating a repeating pattern.
|
||||
#[default]
|
||||
Repeat = 0,
|
||||
|
||||
/// Causes a coordinates to be clamped to the range range, where N is the size of the texture
|
||||
@@ -1009,11 +1005,6 @@ pub enum TextureWrapMode {
|
||||
|
||||
uuid_provider!(TextureWrapMode = "e360d139-4374-4323-a66d-d192809d9d87");
|
||||
|
||||
impl Default for TextureWrapMode {
|
||||
fn default() -> Self {
|
||||
Self::Repeat
|
||||
}
|
||||
}
|
||||
|
||||
/// Texture kind defines pixel format of texture.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||
@@ -1264,8 +1255,10 @@ fn ceil_div_4(x: u32) -> u32 {
|
||||
AsRefStr,
|
||||
)]
|
||||
#[repr(u32)]
|
||||
#[derive(Default)]
|
||||
pub enum CompressionOptions {
|
||||
/// An image will be stored without compression if it is not already compressed.
|
||||
#[default]
|
||||
NoCompression = 0,
|
||||
|
||||
/// An image will be encoded via DXT1 (BC1) compression with low quality if is not
|
||||
@@ -1285,11 +1278,6 @@ pub enum CompressionOptions {
|
||||
|
||||
uuid_provider!(CompressionOptions = "fbdcc081-d0b8-4b62-9925-2de6c013fbf5");
|
||||
|
||||
impl Default for CompressionOptions {
|
||||
fn default() -> Self {
|
||||
Self::NoCompression
|
||||
}
|
||||
}
|
||||
|
||||
fn transmute_slice<T>(bytes: &[u8]) -> &'_ [T] {
|
||||
// SAFETY: This is absolutely safe because `image` crate's Rgb8/Rgba8/etc. and `tbc`s Rgb8/Rgba8/etc.
|
||||
|
||||
@@ -654,7 +654,7 @@ fn make_fs_watcher_event_path_relative_to_tree_root(
|
||||
) -> PathBuf {
|
||||
match root {
|
||||
Some(ref root) => {
|
||||
let remove_prefix = if *root == PathBuf::from(".") {
|
||||
let remove_prefix = if root == Path::new(".") {
|
||||
std::env::current_dir().unwrap()
|
||||
} else {
|
||||
root.clone()
|
||||
|
||||
Reference in New Issue
Block a user