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

Incomplete code #828

Open
YichiZhang0613 opened this issue Nov 22, 2024 · 0 comments
Open

Incomplete code #828

YichiZhang0613 opened this issue Nov 22, 2024 · 0 comments

Comments

@YichiZhang0613
Copy link

In criterion.rs/plot/src/lib.rs, the comment indicate the code will panics if size is a non-positive value(size <= 0.) while the code will panic if size < 0.

/// # Panics
    ///
    /// Panics if `size` is a non-positive value
    fn set(&mut self, size: FontSize) -> &mut Figure {
        let size = size.0;

        assert!(size >= 0.);

        self.font_size = Some(size);
        self
    }

In criterion.rs/plot/src/filledcurve.rs, the code doesn't check whether opacity is outside the range [0, 1].

/// # Panics
    ///
    /// Panics if `opacity` is outside the range `[0, 1]`
    fn set(&mut self, opacity: Opacity) -> &mut Properties {
        self.opacity = Some(opacity.0);
        self
    }
@YichiZhang0613 YichiZhang0613 changed the title Possible incomplete code Incomplete code Nov 22, 2024
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