Skip to content

Commit e8b1236

Browse files
authored
Fix warnings in examples (#180)
1 parent f7d83a5 commit e8b1236

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

examples/open_parented.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ use baseview::{
55
use std::num::NonZeroU32;
66

77
struct ParentWindowHandler {
8-
ctx: softbuffer::Context,
8+
_ctx: softbuffer::Context,
99
surface: softbuffer::Surface,
1010
current_size: PhySize,
1111
damaged: bool,
1212

13-
child_window: Option<WindowHandle>,
13+
_child_window: Option<WindowHandle>,
1414
}
1515

1616
impl ParentWindowHandler {
@@ -33,11 +33,11 @@ impl ParentWindowHandler {
3333

3434
// TODO: no way to query physical size initially?
3535
Self {
36-
ctx,
36+
_ctx: ctx,
3737
surface,
3838
current_size: PhySize::new(512, 512),
3939
damaged: true,
40-
child_window: Some(child_window),
40+
_child_window: Some(child_window),
4141
}
4242
}
4343
}
@@ -76,7 +76,7 @@ impl WindowHandler for ParentWindowHandler {
7676
}
7777

7878
struct ChildWindowHandler {
79-
ctx: softbuffer::Context,
79+
_ctx: softbuffer::Context,
8080
surface: softbuffer::Surface,
8181
current_size: PhySize,
8282
damaged: bool,
@@ -89,7 +89,7 @@ impl ChildWindowHandler {
8989
surface.resize(NonZeroU32::new(512).unwrap(), NonZeroU32::new(512).unwrap()).unwrap();
9090

9191
// TODO: no way to query physical size initially?
92-
Self { ctx, surface, current_size: PhySize::new(256, 256), damaged: true }
92+
Self { _ctx: ctx, surface, current_size: PhySize::new(256, 256), damaged: true }
9393
}
9494
}
9595

examples/open_window.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::time::Duration;
44
use rtrb::{Consumer, RingBuffer};
55

66
#[cfg(target_os = "macos")]
7-
use baseview::copy_to_clipboard;
7+
use baseview::{copy_to_clipboard, MouseEvent};
88
use baseview::{
9-
Event, EventStatus, MouseEvent, PhySize, Window, WindowEvent, WindowHandler, WindowScalePolicy,
9+
Event, EventStatus, PhySize, Window, WindowEvent, WindowHandler, WindowScalePolicy,
1010
};
1111

1212
#[derive(Debug, Clone)]
@@ -17,7 +17,7 @@ enum Message {
1717
struct OpenWindowExample {
1818
rx: Consumer<Message>,
1919

20-
ctx: softbuffer::Context,
20+
_ctx: softbuffer::Context,
2121
surface: softbuffer::Surface,
2222
current_size: PhySize,
2323
damaged: bool,
@@ -88,7 +88,13 @@ fn main() {
8888
let mut surface = unsafe { softbuffer::Surface::new(&ctx, window) }.unwrap();
8989
surface.resize(NonZeroU32::new(512).unwrap(), NonZeroU32::new(512).unwrap()).unwrap();
9090

91-
OpenWindowExample { ctx, surface, rx, current_size: PhySize::new(512, 512), damaged: true }
91+
OpenWindowExample {
92+
_ctx: ctx,
93+
surface,
94+
rx,
95+
current_size: PhySize::new(512, 512),
96+
damaged: true,
97+
}
9298
});
9399
}
94100

0 commit comments

Comments
 (0)