Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence dead code warnings #195

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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