Skip to content

Question about code redundancy #543

Description

@hexi03

Can we use that variant in
/libcraft/blocks/src/block.rs

#[allow(warnings)]
#[allow(clippy::all)]
impl BlockKind {
    /// Returns the `diggable` property of this `BlockKind`.
    pub fn diggable(&self) -> bool {
        match self {
            BlockKind::Bedrock => false,
            BlockKind::Water => false,
            BlockKind::Lava => false,
            BlockKind::MovingPiston => false,
            BlockKind::NetherPortal => false,
            BlockKind::EndPortal => false,
            BlockKind::EndPortalFrame => false,
            BlockKind::CommandBlock => false,
            BlockKind::Barrier => false,
            BlockKind::EndGateway => false,
            BlockKind::RepeatingCommandBlock => false,
            BlockKind::ChainCommandBlock => false,
            BlockKind::StructureBlock => false,
            BlockKind::Jigsaw => false,
            _ => true,
        }
    }
}

Is "true" on enum inheritor is really critical(Maybe there are other checks in other code)? Ths for reply, and sorry in advance if this is a stupid question.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions