diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-14 09:51:12 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-14 09:51:12 -0500 |
| commit | 7b78c39cb604961564b1d4e0a491eafacc85e8cb (patch) | |
| tree | 8618f2a4fc76a389bcabdeb94ff46ab6d74b1d77 /graphics/src/lib.rs | |
| parent | dungeon: refactor manual drop (diff) | |
| download | DungeonCrawl-7b78c39cb604961564b1d4e0a491eafacc85e8cb.tar.gz DungeonCrawl-7b78c39cb604961564b1d4e0a491eafacc85e8cb.tar.bz2 DungeonCrawl-7b78c39cb604961564b1d4e0a491eafacc85e8cb.zip | |
Enable more clippy lints
Diffstat (limited to 'graphics/src/lib.rs')
| -rw-r--r-- | graphics/src/lib.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs index 2633e8d..b42845c 100644 --- a/graphics/src/lib.rs +++ b/graphics/src/lib.rs @@ -89,36 +89,42 @@ pub struct WindowBuilder<'a> { } impl<'a> WindowBuilder<'a> { /// Default window builder - pub fn new() -> Self { - Self::default() + pub const fn new() -> Self { + Self { + title: "Dungeon Crawl", + width: render::RENDER_WIDTH, + height: render::RENDER_HEIGHT, + vsync: false, + verbose: false, + } } /// Set the window title - pub fn title(&mut self, title: &'a str) -> &mut Self { + pub const fn title(&mut self, title: &'a str) -> &mut Self { self.title = title; self } /// Set the default window width - pub fn width(&mut self, width: u16) -> &mut Self { + pub const fn width(&mut self, width: u16) -> &mut Self { self.width = width; self } /// Set the default window height - pub fn height(&mut self, height: u16) -> &mut Self { + pub const fn height(&mut self, height: u16) -> &mut Self { self.height = height; self } /// Toggle vsync support - pub fn vsync(&mut self, vsync: bool) -> &mut Self { + pub const fn vsync(&mut self, vsync: bool) -> &mut Self { self.vsync = vsync; self } /// Toggle verbose logging - pub fn verbose(&mut self, verbose: bool) -> &mut Self { + pub const fn verbose(&mut self, verbose: bool) -> &mut Self { self.verbose = verbose; self } @@ -164,13 +170,7 @@ impl<'a> WindowBuilder<'a> { } impl Default for WindowBuilder<'_> { fn default() -> Self { - Self { - title: "Dungeon Crawl", - width: render::RENDER_WIDTH, - height: render::RENDER_HEIGHT, - vsync: false, - verbose: false, - } + Self::new() } } @@ -198,7 +198,7 @@ impl Window { } /// Toggles the debug UI - pub fn toggle_debug(&mut self) { + pub const fn toggle_debug(&mut self) { self.renderer.toggle_debug(); } @@ -228,7 +228,7 @@ impl Window { } /// Get audio data for the window - pub fn audio(&self) -> &Audio { + pub const fn audio(&self) -> &Audio { &self.audio } } |