Skip to content

Commit

Permalink
Fix a few other warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Sep 12, 2023
1 parent 2398689 commit 85649e5
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/appkit/app/enums.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Various types used at the AppController level.
#![allow(unused_parens)]

use crate::foundation::NSUInteger;

Expand Down
10 changes: 5 additions & 5 deletions src/foundation/urls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<'a> NSURL<'a> {
pub fn bookmark_data(
&self,
options: &[NSURLBookmarkCreationOption],
resource_value_keys: &[NSURLResourceKey],
_resource_value_keys: &[NSURLResourceKey],
relative_to_url: Option<NSURL>
) -> Result<NSData, Box<dyn Error>> {
let mut opts: NSUInteger = 0;
Expand Down Expand Up @@ -125,10 +125,10 @@ impl<'a> NSURL<'a> {

/// Converts bookmark data into a URL.
pub fn from_bookmark_data(
data: NSData,
options: &[NSURLBookmarkResolutionOption],
relative_to_url: Option<NSURL>,
data_is_stale: bool
_data: NSData,
_options: &[NSURLBookmarkResolutionOption],
_relative_to_url: Option<NSURL>,
_data_is_stale: bool
) -> Result<Self, Box<dyn Error>> {
Err("LOL".into())
}
Expand Down
4 changes: 2 additions & 2 deletions src/image/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ impl Image {
#[test]
fn test_image_from_bytes() {
let image_bytes = include_bytes!("../../test-data/favicon.ico");
let image = Image::with_data(image_bytes);
let _image = Image::with_data(image_bytes);
}
// It's unclear where the file is on the ios simulator.
#[test]
#[cfg(target_os = "macos")]
fn test_image_from_file() {
let image = Image::with_contents_of_file("./test-data/favicon.ico");
let _image = Image::with_contents_of_file("./test-data/favicon.ico");
}
2 changes: 1 addition & 1 deletion src/image/uikit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ use crate::foundation::load_or_register_class;
/// have separate classes here since we don't want to waste cycles on methods that will never be
/// used if there's no delegates.
pub(crate) fn register_image_view_class() -> &'static Class {
load_or_register_class("UIImageView", "RSTImageView", |decl| unsafe {})
load_or_register_class("UIImageView", "RSTImageView", |decl| {})

Check warning on line 9 in src/image/uikit.rs

View workflow job for this annotation

GitHub Actions / Check that examples build

unused variable: `decl`
}
2 changes: 1 addition & 1 deletion src/uikit/app/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::uikit::scene::{SceneConnectionOptions, SceneSession};

/// A handy method for grabbing our `AppDelegate` from the pointer. This is different from our
/// standard `utils` version as this doesn't require `RefCell` backing.
fn app<T>(this: &Object) -> &T {
fn app<T>(_this: &Object) -> &T {
unsafe {
//let app_ptr: usize = *this.ivar(APP_DELEGATE);
let app = APP_DELEGATE as *const T;
Expand Down
6 changes: 3 additions & 3 deletions src/uikit/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ where
activate_cocoa_multithreading();

let pool = AutoReleasePool::new();
let cls = register_app_class();
let dl = register_app_delegate_class::<T>();
let w = register_window_scene_delegate_class::<W, F>();
let _cls = register_app_class();
let _dl = register_app_delegate_class::<T>();
let _w = register_window_scene_delegate_class::<W, F>();

let app_delegate = Box::new(delegate);
let vendor = Box::new(scene_delegate_vendor);
Expand Down
1 change: 1 addition & 0 deletions src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ impl View {
/// This handles grabbing autolayout anchor pointers, as well as things related to layering and
/// so on. It returns a generic `View<T>`, which the caller can then customize as needed.
pub(crate) fn init<T>(view: id) -> View<T> {
#[allow(unused_unsafe)]
unsafe {
#[cfg(feature = "autolayout")]
let _: () = msg_send![view, setTranslatesAutoresizingMaskIntoConstraints: false];
Expand Down
4 changes: 2 additions & 2 deletions src/view/uikit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ use crate::view::{ViewDelegate, VIEW_DELEGATE_PTR};
/// have separate classes here since we don't want to waste cycles on methods that will never be
/// used if there's no delegates.
pub(crate) fn register_view_class() -> &'static Class {
load_or_register_class("UIView", "RSTView", |decl| unsafe {})
load_or_register_class("UIView", "RSTView", |decl| {})

Check warning on line 14 in src/view/uikit.rs

View workflow job for this annotation

GitHub Actions / Check that examples build

unused variable: `decl`
}

/// Injects a `UIView` subclass, with some callback and pointer ivars for what we
/// need to do.
pub(crate) fn register_view_class_with_delegate<T: ViewDelegate>(instance: &T) -> &'static Class {
load_or_register_class("UIView", instance.subclass_name(), |decl| unsafe {
load_or_register_class("UIView", instance.subclass_name(), |decl| {
decl.add_ivar::<usize>(VIEW_DELEGATE_PTR);
})
}
2 changes: 1 addition & 1 deletion src/webview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ where
let view = allocate_webview(config, Some(&objc_delegate));
let mut view = WebView::init(view);

&delegate.did_load(view.clone_as_handle());
delegate.did_load(view.clone_as_handle());
view.delegate = Some(delegate);
view
}
Expand Down

0 comments on commit 85649e5

Please sign in to comment.