Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about code redundancy #543

Open
hexi03 opened this issue Apr 14, 2022 · 0 comments
Open

Question about code redundancy #543

hexi03 opened this issue Apr 14, 2022 · 0 comments

Comments

@hexi03
Copy link

hexi03 commented Apr 14, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant