Skip to content

Commit 366db9e

Browse files
committed
Fixed clippy suggestions
1 parent 2bc475d commit 366db9e

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

ctru-rs/examples/gfx-wide-mode.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate ctru;
2-
31
use ctru::console::Console;
42
use ctru::services::hid::KeyPad;
53
use ctru::services::{Apt, Hid};
@@ -10,7 +8,7 @@ fn main() {
108
let apt = Apt::init().unwrap();
119
let hid = Hid::init().unwrap();
1210
let gfx = Gfx::default();
13-
let mut _console = Console::init(gfx.top_screen.borrow_mut());
11+
let mut console = Console::init(gfx.top_screen.borrow_mut());
1412

1513
println!("Press A to enable/disable wide screen mode.");
1614

@@ -22,12 +20,12 @@ fn main() {
2220
}
2321

2422
if hid.keys_down().contains(KeyPad::KEY_A) {
25-
drop(_console);
23+
drop(console);
2624

2725
let wide_mode = gfx.top_screen.borrow().get_wide_mode();
2826
gfx.top_screen.borrow_mut().set_wide_mode(!wide_mode);
2927

30-
_console = Console::init(gfx.top_screen.borrow_mut());
28+
console = Console::init(gfx.top_screen.borrow_mut());
3129
println!("Press A to enable/disable wide screen mode.");
3230
}
3331

ctru-rs/examples/hello-world.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
extern crate ctru;
21
use ctru::console::Console;
32
use ctru::gfx::Gfx;
43
use ctru::services::apt::Apt;
54
use ctru::services::hid::{Hid, KeyPad};
65

7-
extern crate ferris_says;
8-
96
use std::io::BufWriter;
107

118
fn main() {

ctru-rs/examples/network-sockets.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
extern crate ctru;
21
use ctru::console::Console;
32
use ctru::gfx::Gfx;
43
use ctru::services::apt::Apt;

ctru-rs/src/gfx.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ pub trait Screen {
4646
}
4747
}
4848

49-
pub struct TopScreen {
50-
_private: (),
51-
}
52-
pub struct BottomScreen {
53-
_private: (),
54-
}
49+
#[non_exhaustive]
50+
pub struct TopScreen;
51+
#[non_exhaustive]
52+
pub struct BottomScreen;
5553

5654
#[derive(Copy, Clone, Debug)]
5755
/// Side of top screen framebuffer
@@ -68,10 +66,10 @@ pub enum Side {
6866
/// provides helper functions and utilities for software rendering.
6967
///
7068
/// The service exits when this struct is dropped.
69+
#[non_exhaustive]
7170
pub struct Gfx {
7271
pub top_screen: RefCell<TopScreen>,
7372
pub bottom_screen: RefCell<BottomScreen>,
74-
_private: (),
7573
}
7674

7775
impl Gfx {
@@ -88,9 +86,8 @@ impl Gfx {
8886
ctru_sys::gfxInit(top_fb_fmt.into(), bottom_fb_fmt.into(), use_vram_buffers);
8987
}
9088
Gfx {
91-
top_screen: RefCell::new(TopScreen { _private: () }),
92-
bottom_screen: RefCell::new(BottomScreen { _private: () }),
93-
_private: (),
89+
top_screen: RefCell::new(TopScreen),
90+
bottom_screen: RefCell::new(BottomScreen),
9491
}
9592
}
9693

@@ -169,9 +166,8 @@ impl Default for Gfx {
169166
fn default() -> Self {
170167
unsafe { ctru_sys::gfxInitDefault() };
171168
Gfx {
172-
top_screen: RefCell::new(TopScreen { _private: () }),
173-
bottom_screen: RefCell::new(BottomScreen { _private: () }),
174-
_private: (),
169+
top_screen: RefCell::new(TopScreen),
170+
bottom_screen: RefCell::new(BottomScreen),
175171
}
176172
}
177173
}

0 commit comments

Comments
 (0)