Repository: gtk-rs/gtk3-rs (language: rust)

Issue:
[HELP] Why is gdk::Atom::value() unsafe
As far as I can tell, this function just casts a number to another number.

https://github.com/gtk-rs/gtk3-rs/blob/69a49423a4164a2d1239af17279cf5154075007c/gdk/src/atom.rs#L47-L49

 I am not quite sure what `ffi::GdkAtom` actually is, but it seems to be an integer cast to a pointer (???): https://github.com/gtk-rs/gtk3-rs/blob/69a49423a4164a2d1239af17279cf5154075007c/gdk/src/atom.rs#L12

Thus, I would suggest to drop the `unsafe` from here: https://github.com/gtk-rs/gtk3-rs/blob/69a49423a4164a2d1239af17279cf5154075007c/gdk/src/atom.rs#L47


Discussion / hints:
It probably shouldn't...the commit that added it doesn't mention the reasoning behind 
It was apparently because of a clippy lint. Might be worth giving it another try if the situation changed.

Fix patch:
diff --git a/gdk/src/atom.rs b/gdk/src/atom.rs
index 02a53ea1cc5f..a31bb2e83e6e 100644
--- a/gdk/src/atom.rs
+++ b/gdk/src/atom.rs
@@ -44,7 +44,7 @@ impl Atom {
         unsafe { from_glib_full(ffi::gdk_atom_name(self.0)) }
     }
 
-    pub unsafe fn value(self) -> usize {
+    pub fn value(self) -> usize {
         self.0 as usize
     }
 }


Test patch: