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 Aug 29, 2022
1 parent 981afda commit d281529
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 17 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 @@ -90,7 +90,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 @@ -133,10 +133,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 @@ -290,11 +290,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 @@ -18,7 +18,7 @@ pub(crate) fn register_image_view_class() -> &'static Class {

INIT.call_once(|| unsafe {
let superclass = class!(UIImageView);
let mut decl = ClassBuilder::new("RSTImageView", superclass).expect("Failed to get RSTVIEW");
let decl = ClassBuilder::new("RSTImageView", superclass).expect("Failed to get RSTVIEW");
VIEW_CLASS = Some(decl.register());
});

Expand Down
2 changes: 1 addition & 1 deletion src/uikit/app/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::cloudkit::share::CKShareMetaData;

/// 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
10 changes: 5 additions & 5 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 Expand Up @@ -149,8 +149,8 @@ impl<T, W, F> App<T, W, F> {

let c_args = args.iter().map(|arg| arg.as_ptr()).collect::<Vec<*const c_char>>();

let mut s = NSString::new("RSTApplication");
let mut s2 = NSString::new("RSTAppDelegate");
let s = NSString::new("RSTApplication");
let s2 = NSString::new("RSTAppDelegate");

unsafe {
UIApplicationMain(c_args.len() as c_int, c_args.as_ptr(), s.into(), s2.into());
Expand Down
1 change: 1 addition & 0 deletions src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,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 @@ -19,7 +19,7 @@ pub(crate) fn register_view_class() -> &'static Class {

INIT.call_once(|| unsafe {
let superclass = class!(UIView);
let mut decl = ClassBuilder::new("RSTView", superclass).unwrap();
let decl = ClassBuilder::new("RSTView", superclass).unwrap();
VIEW_CLASS = Some(decl.register());
});

Expand All @@ -29,7 +29,7 @@ pub(crate) fn register_view_class() -> &'static Class {
/// 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 @@ -242,7 +242,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 d281529

Please sign in to comment.