]> uap-core.de Git - note.git/commitdiff
fix some warnings
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 19 May 2026 17:58:02 +0000 (19:58 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 19 May 2026 17:58:02 +0000 (19:58 +0200)
ui-rs/src/ui/label.rs
ui-rs/src/ui/menu.rs
ui-rs/src/ui/toolbar.rs
ui-rs/src/ui/toolkit.rs

index 58212a64286f81095f8af2cad980aee9029e9175..9de206e8349832e3efef945ec58068c87fbf3ba8 100644 (file)
@@ -83,9 +83,7 @@ impl<'a, T> Drop for LabelBuilder<'a, T> {
 
 impl<'a, T> LabelBuilder<'a, T> {
     pub fn create(&mut self) -> Label {
-        unsafe {
-            Label { ptr: (self.create)(self.obj.ptr, self.args) }
-        }
+        Label { ptr: (self.create)(self.obj.ptr, self.args) }
     }
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
index 0b867bcb58d1050bc11a40b238e927ee266e21db..9d84e235328c73859bee020dc2ce5428c46b5f36 100644 (file)
@@ -160,7 +160,7 @@ impl<T: UiModel + UiActions> MenuItemBuilder<T> {
     pub fn onclick<F>(&mut self, f: F) -> &mut Self
     where F: FnMut(&mut event::Event<T>) + 'static {
         let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
-        let mut ctx = UiContext { ptr: self.ctx };
+        let ctx = UiContext { ptr: self.ctx };
         let ptr = ctx.reg_box(wrapper);
         unsafe {
             ui_menuitem_args_set_onclick(self.args, Some(event::event_wrapper::<T>));
@@ -211,7 +211,7 @@ impl<T: UiModel + UiActions> MenuToggleItemBuilder<T> {
     pub fn onchange<F>(&mut self, f: F) -> &mut Self
     where F: FnMut(&mut event::Event<T>) + 'static {
         let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
-        let mut ctx = UiContext { ptr: self.ctx };
+        let ctx = UiContext { ptr: self.ctx };
         let ptr = ctx.reg_box(wrapper);
         unsafe {
             ui_menutoggleitem_args_set_onchange(self.args, Some(event::event_wrapper::<T>));
index 2f8fa35e5d35a2c8cf512a4549e34309c8397ff8..defdbab688d7e06183909d94d7c100061539211d 100644 (file)
@@ -157,7 +157,7 @@ impl<T: UiModel + UiActions> ToolbarItemBuilder<T> {
     pub fn onclick<F>(&mut self, f: F) -> &mut Self
     where F: FnMut(&mut event::Event<T>) + 'static {
         let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
-        let mut ctx = UiContext { ptr: self.ctx };
+        let ctx = UiContext { ptr: self.ctx };
         let ptr = ctx.reg_box(wrapper);
         unsafe {
             ui_toolbar_item_args_set_onclick(self.args, Some(event::event_wrapper::<T>));
@@ -224,7 +224,7 @@ impl<T: UiModel + UiActions> ToolbarToggleItemBuilder<T> {
     pub fn onchange<F>(&mut self, f: F) -> &mut Self
     where F: FnMut(&mut event::Event<T>) + 'static {
         let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
-        let mut ctx = UiContext { ptr: self.ctx };
+        let ctx = UiContext { ptr: self.ctx };
         let ptr = ctx.reg_box(wrapper);
         unsafe {
             ui_toolbar_toggleitem_args_set_onchange(self.args, Some(event::event_wrapper::<T>));
index 483e2a9712b7653bad6815da99f0d911b1074100..0fc6609840cf0c3c674096cf3192c4f541959483 100644 (file)
@@ -158,7 +158,7 @@ impl<T: UiModel + UiActions> UiDoc<T> {
     pub fn new(mut data: T) -> UiDoc<T> {
         unsafe {
             let doc = ui_document_new(mem::size_of::<*mut T>());
-            let mut ctx = UiContext { ptr: ui_document_context(doc) };
+            let ctx = UiContext { ptr: ui_document_context(doc) };
             data.init(&ctx);
             let data_ptr = ctx.reg_box(Box::new(data)); // returns *mut T
             let doc_storage: *mut *mut T = doc.cast();
@@ -307,7 +307,7 @@ impl<T> Drop for UiObjRef<T> {
 
             // only unregister if the object still exists
             if !obj_ptr.is_null() {
-                let ctx = unsafe { ui_object_get_context(obj_ptr) };
+                let ctx = ui_object_get_context(obj_ptr);
                 let xptr = &mut *self.ptr as *mut *mut ffi::UiObject;
                 ui_remove_destructor(ctx, xptr as *mut c_void);
             }