Skip to content

Commit

Permalink
Silence dead code warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DougLau committed Oct 28, 2023
1 parent ad5d169 commit 2e46ffb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/gelatin/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl Application {
self.windows.insert(window.get_id(), window);
}

#[allow(dead_code)]
pub fn add_global_event_handler<
F: FnMut(&Event<()>) -> NextUpdate + 'static,
>(
Expand Down
1 change: 1 addition & 0 deletions src/gelatin/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ pub struct LogicalRect {
}

impl LogicalRect {
#[allow(dead_code)]
#[inline]
pub fn left(&self) -> f32 {
self.pos.vec.x
Expand Down
12 changes: 6 additions & 6 deletions src/gelatin/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Idk man
use std::{
any::Any, error::Error, fmt, ops::Deref, path::PathBuf, rc::Rc,
any::Any, error::Error, fmt, path::PathBuf, rc::Rc,
time::Instant, vec::Vec,
};

Expand Down Expand Up @@ -29,17 +29,13 @@ pub mod window;
#[derive(Debug)]
pub enum WidgetError {
Image(image::ImageError),
Custom(Box<dyn Error>),
}
impl fmt::Display for WidgetError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
WidgetError::Image(img_err) => {
write!(f, "WidgetError: Image ({})", img_err)?
}
WidgetError::Custom(err) => {
write!(f, "WidgetError: Custom ({})", err)?
}
}
Ok(())
}
Expand All @@ -48,7 +44,6 @@ impl Error for WidgetError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
match self {
WidgetError::Image(img_err) => Some(img_err),
WidgetError::Custom(err) => Some(Deref::deref(err)),
}
}
}
Expand Down Expand Up @@ -267,6 +262,7 @@ pub fn widget_data_ptr(rc: &Rc<dyn Widget>) -> *const u8 {
#[macro_export]
macro_rules! add_common_widget_functions {
($data_field:ident) => {
#[allow(dead_code)]
pub fn set_margin_all(&self, pixels: f32) {
let mut borrowed = self.$data_field.borrow_mut();
borrowed.placement.margin_left = pixels;
Expand All @@ -276,21 +272,25 @@ macro_rules! add_common_widget_functions {
borrowed.render_validity.invalidate();
}

#[allow(dead_code)]
pub fn set_margin_left(&self, pixels: f32) {
let mut borrowed = self.$data_field.borrow_mut();
borrowed.placement.margin_left = pixels;
borrowed.render_validity.invalidate();
}
#[allow(dead_code)]
pub fn set_margin_right(&self, pixels: f32) {
let mut borrowed = self.$data_field.borrow_mut();
borrowed.placement.margin_right = pixels;
borrowed.render_validity.invalidate();
}
#[allow(dead_code)]
pub fn set_margin_top(&self, pixels: f32) {
let mut borrowed = self.$data_field.borrow_mut();
borrowed.placement.margin_top = pixels;
borrowed.render_validity.invalidate();
}
#[allow(dead_code)]
pub fn set_margin_bottom(&self, pixels: f32) {
let mut borrowed = self.$data_field.borrow_mut();
borrowed.placement.margin_bottom = pixels;
Expand Down
1 change: 1 addition & 0 deletions src/gelatin/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub struct Picture {
}

impl Picture {
#[allow(dead_code)]
pub fn new<T: Into<path::PathBuf>>(path: T) -> Picture {
Picture {
data: RefCell::new(PictureData::Path(path.into())),
Expand Down

0 comments on commit 2e46ffb

Please sign in to comment.