[niepce] rust: Fix warning about dropping Box
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] rust: Fix warning about dropping Box
- Date: Sat, 15 Oct 2022 15:23:10 +0000 (UTC)
commit ebcfce16fd51f6bfe8e1c249a2956d00fb0ede70
Author: Hubert Figuière <hub figuiere net>
Date: Sat Oct 15 11:12:33 2022 -0400
rust: Fix warning about dropping Box
- This appeared with clippy and newer versions of Rust compiler
crates/npc-engine/src/db/keyword.rs | 4 ++--
crates/npc-engine/src/db/label.rs | 4 ++--
crates/npc-engine/src/db/libfile.rs | 2 +-
crates/npc-engine/src/lib.rs | 6 +++---
crates/npc-engine/src/library/notification.rs | 2 +-
crates/npc-engine/src/library/thumbnail_cache.rs | 4 ++--
crates/npc-fwk/src/base/date.rs | 2 +-
crates/npc-fwk/src/base/propertyvalue.rs | 2 +-
crates/npc-fwk/src/base/rgbcolour.rs | 2 +-
crates/npc-fwk/src/toolkit/thumbnail.rs | 2 +-
crates/npc-fwk/src/utils/exempi.rs | 2 +-
crates/npc-fwk/src/utils/files.rs | 2 +-
niepce-main/src/libraryclient.rs | 4 ++--
niepce-main/src/niepce/ui/image_grid_view.rs | 2 +-
niepce-main/src/niepce/ui/image_list_store.rs | 2 +-
niepce-main/src/niepce/ui/thumb_strip_view.rs | 2 +-
16 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/crates/npc-engine/src/db/keyword.rs b/crates/npc-engine/src/db/keyword.rs
index af84df06..7153ae29 100644
--- a/crates/npc-engine/src/db/keyword.rs
+++ b/crates/npc-engine/src/db/keyword.rs
@@ -1,7 +1,7 @@
/*
* niepce - engine/db/keyword.rs
*
- * Copyright (C) 2017-2019 Hubert Figuière
+ * Copyright (C) 2017-2022 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -91,5 +91,5 @@ pub extern "C" fn engine_db_keyword_keyword(obj: &Keyword) -> *mut c_char {
/// Dereference raw pointer.
#[no_mangle]
pub unsafe extern "C" fn engine_db_keyword_delete(kw: *mut Keyword) {
- Box::from_raw(kw);
+ drop(Box::from_raw(kw));
}
diff --git a/crates/npc-engine/src/db/label.rs b/crates/npc-engine/src/db/label.rs
index 445277af..b29db23d 100644
--- a/crates/npc-engine/src/db/label.rs
+++ b/crates/npc-engine/src/db/label.rs
@@ -1,7 +1,7 @@
/*
* niepce - engine/db/label.rs
*
- * Copyright (C) 2017-2019 Hubert Figuière
+ * Copyright (C) 2017-2022 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -89,7 +89,7 @@ impl FromDb for Label {
/// Dereference raw pointer.
#[no_mangle]
pub unsafe extern "C" fn engine_db_label_delete(l: *mut Label) {
- Box::from_raw(l);
+ drop(Box::from_raw(l));
}
#[no_mangle]
diff --git a/crates/npc-engine/src/db/libfile.rs b/crates/npc-engine/src/db/libfile.rs
index 3b498029..2555d10f 100644
--- a/crates/npc-engine/src/db/libfile.rs
+++ b/crates/npc-engine/src/db/libfile.rs
@@ -299,7 +299,7 @@ pub unsafe extern "C" fn engine_db_libfile_new(
/// Dereference raw pointer.
#[no_mangle]
pub unsafe extern "C" fn engine_db_libfile_delete(lf: *mut LibFile) {
- Box::from_raw(lf);
+ drop(Box::from_raw(lf));
}
#[no_mangle]
diff --git a/crates/npc-engine/src/lib.rs b/crates/npc-engine/src/lib.rs
index 874c6140..ece79e10 100644
--- a/crates/npc-engine/src/lib.rs
+++ b/crates/npc-engine/src/lib.rs
@@ -1,7 +1,7 @@
/*
* niepce - engine/mod.rs
*
- * Copyright (C) 2017-2021 Hubert Figuière
+ * Copyright (C) 2017-2022 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ pub extern "C" fn eng_property_set_new() -> *mut NiepcePropertySet {
/// Dereference the pointer.
#[no_mangle]
pub unsafe extern "C" fn eng_property_set_delete(set: *mut NiepcePropertySet) {
- Box::from_raw(set);
+ drop(Box::from_raw(set));
}
#[no_mangle]
@@ -60,7 +60,7 @@ pub extern "C" fn eng_property_bag_new() -> *mut NiepcePropertyBag {
/// Dereference the raw pointer.
#[no_mangle]
pub unsafe extern "C" fn eng_property_bag_delete(bag: *mut NiepcePropertyBag) {
- Box::from_raw(bag);
+ drop(Box::from_raw(bag));
}
#[no_mangle]
diff --git a/crates/npc-engine/src/library/notification.rs b/crates/npc-engine/src/library/notification.rs
index 351f1f3f..8e81ea28 100644
--- a/crates/npc-engine/src/library/notification.rs
+++ b/crates/npc-engine/src/library/notification.rs
@@ -163,7 +163,7 @@ pub extern "C" fn engine_library_notify_filestatus_changed(
/// Use raw pointer.
#[no_mangle]
pub unsafe extern "C" fn engine_library_notification_delete(n: *mut LibNotification) {
- Box::from_raw(n);
+ drop(Box::from_raw(n));
}
/// # Safety
diff --git a/crates/npc-engine/src/library/thumbnail_cache.rs
b/crates/npc-engine/src/library/thumbnail_cache.rs
index b4bdc1eb..1a58a8b6 100644
--- a/crates/npc-engine/src/library/thumbnail_cache.rs
+++ b/crates/npc-engine/src/library/thumbnail_cache.rs
@@ -1,7 +1,7 @@
/*
* niepce - library/thumbnail_cache.rs
*
- * Copyright (C) 2020-2021 Hubert Figuière
+ * Copyright (C) 2020-2022 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -237,7 +237,7 @@ pub unsafe extern "C" fn engine_library_thumbnail_cache_new(
/// Dereference raw pointer.
#[no_mangle]
pub unsafe extern "C" fn engine_library_thumbnail_cache_delete(obj: *mut ThumbnailCache) {
- Box::from_raw(obj);
+ drop(Box::from_raw(obj));
}
#[no_mangle]
diff --git a/crates/npc-fwk/src/base/date.rs b/crates/npc-fwk/src/base/date.rs
index bf400da5..d7b5ad71 100644
--- a/crates/npc-fwk/src/base/date.rs
+++ b/crates/npc-fwk/src/base/date.rs
@@ -39,7 +39,7 @@ pub fn xmp_date_from(d: &chrono::DateTime<chrono::Utc>) -> exempi::DateTime {
/// Dereference the raw pointer.
#[no_mangle]
pub unsafe extern "C" fn fwk_date_delete(date: *mut Date) {
- Box::from_raw(date);
+ drop(Box::from_raw(date));
}
#[no_mangle]
diff --git a/crates/npc-fwk/src/base/propertyvalue.rs b/crates/npc-fwk/src/base/propertyvalue.rs
index 513500f7..3b61455d 100644
--- a/crates/npc-fwk/src/base/propertyvalue.rs
+++ b/crates/npc-fwk/src/base/propertyvalue.rs
@@ -69,7 +69,7 @@ pub extern "C" fn fwk_property_value_new_string_array() -> *mut PropertyValue {
#[no_mangle]
pub unsafe extern "C" fn fwk_property_value_delete(v: *mut PropertyValue) {
if !v.is_null() {
- Box::from_raw(v);
+ drop(Box::from_raw(v));
}
}
diff --git a/crates/npc-fwk/src/base/rgbcolour.rs b/crates/npc-fwk/src/base/rgbcolour.rs
index f3181621..c4fe8052 100644
--- a/crates/npc-fwk/src/base/rgbcolour.rs
+++ b/crates/npc-fwk/src/base/rgbcolour.rs
@@ -95,7 +95,7 @@ pub extern "C" fn fwk_rgbcolour_to_string(c: &RgbColour) -> *mut c_char {
/// Dereference the pointer.
#[no_mangle]
pub unsafe extern "C" fn fwk_rgbcolour_delete(c: *mut RgbColour) {
- Box::from_raw(c);
+ drop(Box::from_raw(c));
}
#[no_mangle]
diff --git a/crates/npc-fwk/src/toolkit/thumbnail.rs b/crates/npc-fwk/src/toolkit/thumbnail.rs
index b07edbcb..fdc082e2 100644
--- a/crates/npc-fwk/src/toolkit/thumbnail.rs
+++ b/crates/npc-fwk/src/toolkit/thumbnail.rs
@@ -202,7 +202,7 @@ pub unsafe extern "C" fn fwk_toolkit_thumbnail_file(
/// Dereference the pointer
#[no_mangle]
pub unsafe extern "C" fn fwk_toolkit_thumbnail_delete(obj: *mut Thumbnail) {
- Box::from_raw(obj);
+ drop(Box::from_raw(obj));
}
/// Create a %Thumbnail from a %GdkPixbuf
diff --git a/crates/npc-fwk/src/utils/exempi.rs b/crates/npc-fwk/src/utils/exempi.rs
index 3fc47689..c9d7debf 100644
--- a/crates/npc-fwk/src/utils/exempi.rs
+++ b/crates/npc-fwk/src/utils/exempi.rs
@@ -523,7 +523,7 @@ pub extern "C" fn fwk_exempi_manager_new() -> *mut ExempiManager {
/// Dereference the pointer.
#[no_mangle]
pub unsafe extern "C" fn fwk_exempi_manager_delete(em: *mut ExempiManager) {
- Box::from_raw(em);
+ drop(Box::from_raw(em));
}
#[cfg(test)]
diff --git a/crates/npc-fwk/src/utils/files.rs b/crates/npc-fwk/src/utils/files.rs
index d30f961b..28014ab3 100644
--- a/crates/npc-fwk/src/utils/files.rs
+++ b/crates/npc-fwk/src/utils/files.rs
@@ -105,7 +105,7 @@ pub extern "C" fn fwk_file_list_new() -> *mut FileList {
/// Dereference the pointer
#[no_mangle]
pub unsafe extern "C" fn fwk_file_list_delete(l: *mut FileList) {
- Box::from_raw(l);
+ drop(Box::from_raw(l));
}
/// Get the files in directory dir
diff --git a/niepce-main/src/libraryclient.rs b/niepce-main/src/libraryclient.rs
index b37e3568..349c3884 100644
--- a/niepce-main/src/libraryclient.rs
+++ b/niepce-main/src/libraryclient.rs
@@ -208,7 +208,7 @@ pub extern "C" fn lcchannel_new(
/// Dereference a pointer.
#[no_mangle]
pub unsafe extern "C" fn lcchannel_delete(obj: *mut LcChannel) {
- Box::from_raw(obj);
+ drop(Box::from_raw(obj));
}
/// # Safety
@@ -229,7 +229,7 @@ pub unsafe extern "C" fn libraryclient_new(
/// Dereference a pointer.
#[no_mangle]
pub unsafe extern "C" fn libraryclient_delete(obj: *mut LibraryClientWrapper) {
- Box::from_raw(obj);
+ drop(Box::from_raw(obj));
}
#[no_mangle]
diff --git a/niepce-main/src/niepce/ui/image_grid_view.rs b/niepce-main/src/niepce/ui/image_grid_view.rs
index 6fa09cfc..6f2c98e3 100644
--- a/niepce-main/src/niepce/ui/image_grid_view.rs
+++ b/niepce-main/src/niepce/ui/image_grid_view.rs
@@ -108,5 +108,5 @@ pub unsafe extern "C" fn npc_image_grid_view_get_icon_view(
/// Use raw pointers
#[no_mangle]
pub unsafe extern "C" fn npc_image_grid_view_release(view: *mut ImageGridView) {
- Box::from_raw(view);
+ drop(Box::from_raw(view));
}
diff --git a/niepce-main/src/niepce/ui/image_list_store.rs b/niepce-main/src/niepce/ui/image_list_store.rs
index f3df0801..55a73e65 100644
--- a/niepce-main/src/niepce/ui/image_list_store.rs
+++ b/niepce-main/src/niepce/ui/image_list_store.rs
@@ -300,7 +300,7 @@ pub extern "C" fn npc_image_list_store_new() -> *mut ImageListStore {
#[no_mangle]
pub unsafe extern "C" fn npc_image_list_store_delete(self_: *mut ImageListStore) {
assert!(!self_.is_null());
- Box::from_raw(self_);
+ drop(Box::from_raw(self_));
}
/// Return the gobj for the GtkListStore. You must ref it to hold it.
diff --git a/niepce-main/src/niepce/ui/thumb_strip_view.rs b/niepce-main/src/niepce/ui/thumb_strip_view.rs
index 6e2360fc..dc2ae5f3 100644
--- a/niepce-main/src/niepce/ui/thumb_strip_view.rs
+++ b/niepce-main/src/niepce/ui/thumb_strip_view.rs
@@ -228,5 +228,5 @@ pub unsafe extern "C" fn npc_thumb_strip_view_get_icon_view(
/// Use raw pointers
#[no_mangle]
pub unsafe extern "C" fn npc_thumb_strip_view_release(stripview: *mut ThumbStripView) {
- Box::from_raw(stripview);
+ drop(Box::from_raw(stripview));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]