Skip to content

Commit

Permalink
Fix a misleading error message for scale == 0 (#20)
Browse files Browse the repository at this point in the history
"scale must be >= 0" would mean 0 is acceptable while it is not.
While at it, replace the comparison + println! with an assert!.
  • Loading branch information
andrewshadura authored Feb 3, 2021
1 parent 81ac1cc commit ed50a4c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/output_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ impl OutputSettingsBuilder {
///
/// Panics if the scale is set to `0`.
pub fn scale(mut self, scale: u32) -> Self {
if scale == 0 {
panic!("scale must be >= 0");
}
assert!(scale > 0, "scale must be > 0");

self.scale = Some(scale);

Expand Down

0 comments on commit ed50a4c

Please sign in to comment.