mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 19:20:43 +01:00
fix: clippy fixes
This commit is contained in:
@@ -16,7 +16,7 @@ where
|
||||
{
|
||||
let app_name = app_name
|
||||
.into()
|
||||
.map(|app_name| std::ffi::CString::new(app_name))
|
||||
.map(std::ffi::CString::new)
|
||||
.transpose()?;
|
||||
|
||||
if unsafe {
|
||||
@@ -56,7 +56,7 @@ pub fn get_app_name() -> Option<String> {
|
||||
let app_name_c: *const std::os::raw::c_char = unsafe { notify_get_app_name() };
|
||||
|
||||
if app_name_c.is_null() {
|
||||
return None;
|
||||
None
|
||||
} else {
|
||||
Some(
|
||||
unsafe { std::ffi::CStr::from_ptr(app_name_c) }
|
||||
@@ -72,7 +72,7 @@ pub fn get_app_icon() -> Option<String> {
|
||||
let app_icon_c: *const std::os::raw::c_char = unsafe { notify_get_app_icon() };
|
||||
|
||||
if app_icon_c.is_null() {
|
||||
return None;
|
||||
None
|
||||
} else {
|
||||
Some(
|
||||
unsafe { std::ffi::CStr::from_ptr(app_icon_c) }
|
||||
|
||||
@@ -56,12 +56,12 @@ impl<'a> Notification {
|
||||
|
||||
let body = body
|
||||
.into()
|
||||
.map(|body| std::ffi::CString::new(body))
|
||||
.map(std::ffi::CString::new)
|
||||
.transpose()?;
|
||||
|
||||
let icon = icon
|
||||
.into()
|
||||
.map(|icon| std::ffi::CString::new(icon))
|
||||
.map(std::ffi::CString::new)
|
||||
.transpose()?;
|
||||
|
||||
let inner = unsafe {
|
||||
@@ -232,7 +232,7 @@ impl<'a> Notification {
|
||||
/// Note that the timeout may be ignored by the server.
|
||||
pub fn set_timeout(&mut self, timeout: Timeout) {
|
||||
let timeout_c = match timeout {
|
||||
Timeout::Default => NOTIFY_EXPIRES_DEFAULT as i32,
|
||||
Timeout::Default => NOTIFY_EXPIRES_DEFAULT,
|
||||
Timeout::Never => NOTIFY_EXPIRES_NEVER as i32,
|
||||
Timeout::Custom(i) => i,
|
||||
};
|
||||
@@ -295,12 +295,12 @@ impl<'a> Notification {
|
||||
|
||||
let body = body
|
||||
.into()
|
||||
.map(|body| std::ffi::CString::new(body))
|
||||
.map(std::ffi::CString::new)
|
||||
.transpose()?;
|
||||
|
||||
let icon = icon
|
||||
.into()
|
||||
.map(|icon| std::ffi::CString::new(icon))
|
||||
.map(std::ffi::CString::new)
|
||||
.transpose()?;
|
||||
|
||||
unsafe {
|
||||
|
||||
Reference in New Issue
Block a user