Skip to content

Commit

Permalink
Create const Config::new() function
Browse files Browse the repository at this point in the history
  • Loading branch information
msrd0 committed Apr 29, 2024
1 parent ba12f8a commit efacd8e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,9 @@ impl Config {
_ => (c, c.width().unwrap_or(1)),
}
}
}

impl Default for Config {
fn default() -> Self {
/// Create a new, default config.
pub const fn new() -> Self {
Self {
cross_gap: true,
label_attach: LabelAttach::Middle,
Expand All @@ -528,6 +527,13 @@ impl Default for Config {
}
}


impl Default for Config {
fn default() -> Self {
Self::new()
}
}

#[test]
#[should_panic]
#[allow(clippy::reversed_empty_ranges)]
Expand Down

0 comments on commit efacd8e

Please sign in to comment.