summary history branches tags files
commit:10476b9f5e48d1a4ecd23424aac1d171f0433524
author:Trevor Bentley
committer:Trevor Bentley
date:Sun Jun 23 21:12:00 2019 +0200
parents:d3bcf6dd9908570e8d1d650622a762a985cde158
Fix compiler warnings
diff --git a/examples/example.rs b/examples/example.rs
line changes: +1/-1
index b6b18a1..99852c3
--- a/examples/example.rs
+++ b/examples/example.rs
@@ -176,5 +176,5 @@ fn main() {
     populate(bar_rc.clone(), 1, stopper);
 
     // Enter OS X application loop.
-    nsapp.run(fruitbasket::RunPeriod::Forever);
+    nsapp.run(fruitbasket::RunPeriod::Forever).expect("Failed to launch app");
 }

diff --git a/src/interface.rs b/src/interface.rs
line changes: +4/-4
index ce0fe2f..f2aa51c
--- a/src/interface.rs
+++ b/src/interface.rs
@@ -45,7 +45,7 @@ pub type ItemId = u64;
 /// # Arguments
 ///
 /// * first - `ItemId` of the button that was pressed
-pub type ButtonCb = Box<Fn(&ItemId)>;
+pub type ButtonCb = Box<dyn Fn(&ItemId)>;
 
 /// A callback that is called when the value of a slide on a Touch Bar changes
 ///
@@ -56,7 +56,7 @@ pub type ButtonCb = Box<Fn(&ItemId)>;
 ///
 /// * first - `ItemId` of the slider that was changed
 /// * second - Current value of the slider
-pub type SliderCb = Box<Fn(&ItemId, f64)>;
+pub type SliderCb = Box<dyn Fn(&ItemId, f64)>;
 
 /// A callback that is called when an item is swiped
 ///
@@ -70,7 +70,7 @@ pub type SliderCb = Box<Fn(&ItemId, f64)>;
 /// * second - `SwipeState` representing the current gesture's lifecycle
 /// * third - Horizontal translation of the swipe, in pixels (positive is right,
 ///   negative is left).
-pub type SwipeCb = Box<Fn(&ItemId, SwipeState, f64)>;
+pub type SwipeCb = Box<dyn Fn(&ItemId, SwipeState, f64)>;
 
 /// An allocated image that can be added to items
 ///
@@ -411,7 +411,7 @@ pub trait TTouchbar {
     /// # Returns
     ///
     /// A newly allocated scrubber item
-    fn create_text_scrubber(&mut self, data: Rc<TScrubberData>) -> ItemId {0}
+    fn create_text_scrubber(&mut self, data: Rc<dyn TScrubberData>) -> ItemId {0}
 
     /// Selects the given index in a scrubber
     ///

diff --git a/src/touchbar.rs b/src/touchbar.rs
line changes: +3/-3
index 890a531..5bf69b1
--- a/src/touchbar.rs
+++ b/src/touchbar.rs
@@ -357,7 +357,7 @@ struct InternalItem {
     view: *mut Object,
     ident: Ident,
     control: Option<*mut Object>,
-    scrubber: Option<Rc<TScrubberData>>,
+    scrubber: Option<Rc<dyn TScrubberData>>,
     button_cb: Option<ButtonCb>,
     slider_cb: Option<SliderCb>,
     swipe_cb: Option<SwipeCb>,
@@ -546,7 +546,7 @@ impl RustTouchbarDelegateWrapper {
             None => None,
         }
     }
-    fn find_scrubber_callbacks(&self, scrubber: u64) -> Option<&Rc<TScrubberData>> {
+    fn find_scrubber_callbacks(&self, scrubber: u64) -> Option<&Rc<dyn TScrubberData>> {
         match self.item_map.values().into_iter().filter(|x| {
             x._type == ItemType::Scrubber && x.control.unwrap() as u64 == scrubber
         }).next() {
@@ -794,7 +794,7 @@ impl TTouchbar for Touchbar {
         }
     }
 
-    fn create_text_scrubber(&mut self, data: Rc<TScrubberData>) -> ItemId {
+    fn create_text_scrubber(&mut self, data: Rc<dyn TScrubberData>) -> ItemId {
         unsafe {
             let ident = self.generate_ident();
             let cls = RRCustomTouchBarItem::class();