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
|
let app_name = app_name
|
||||||
.into()
|
.into()
|
||||||
.map(|app_name| std::ffi::CString::new(app_name))
|
.map(std::ffi::CString::new)
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
if unsafe {
|
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() };
|
let app_name_c: *const std::os::raw::c_char = unsafe { notify_get_app_name() };
|
||||||
|
|
||||||
if app_name_c.is_null() {
|
if app_name_c.is_null() {
|
||||||
return None;
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(
|
Some(
|
||||||
unsafe { std::ffi::CStr::from_ptr(app_name_c) }
|
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() };
|
let app_icon_c: *const std::os::raw::c_char = unsafe { notify_get_app_icon() };
|
||||||
|
|
||||||
if app_icon_c.is_null() {
|
if app_icon_c.is_null() {
|
||||||
return None;
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(
|
Some(
|
||||||
unsafe { std::ffi::CStr::from_ptr(app_icon_c) }
|
unsafe { std::ffi::CStr::from_ptr(app_icon_c) }
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ impl<'a> Notification {
|
|||||||
|
|
||||||
let body = body
|
let body = body
|
||||||
.into()
|
.into()
|
||||||
.map(|body| std::ffi::CString::new(body))
|
.map(std::ffi::CString::new)
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
let icon = icon
|
let icon = icon
|
||||||
.into()
|
.into()
|
||||||
.map(|icon| std::ffi::CString::new(icon))
|
.map(std::ffi::CString::new)
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
let inner = unsafe {
|
let inner = unsafe {
|
||||||
@@ -232,7 +232,7 @@ impl<'a> Notification {
|
|||||||
/// Note that the timeout may be ignored by the server.
|
/// Note that the timeout may be ignored by the server.
|
||||||
pub fn set_timeout(&mut self, timeout: Timeout) {
|
pub fn set_timeout(&mut self, timeout: Timeout) {
|
||||||
let timeout_c = match 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::Never => NOTIFY_EXPIRES_NEVER as i32,
|
||||||
Timeout::Custom(i) => i,
|
Timeout::Custom(i) => i,
|
||||||
};
|
};
|
||||||
@@ -295,12 +295,12 @@ impl<'a> Notification {
|
|||||||
|
|
||||||
let body = body
|
let body = body
|
||||||
.into()
|
.into()
|
||||||
.map(|body| std::ffi::CString::new(body))
|
.map(std::ffi::CString::new)
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
let icon = icon
|
let icon = icon
|
||||||
.into()
|
.into()
|
||||||
.map(|icon| std::ffi::CString::new(icon))
|
.map(std::ffi::CString::new)
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|||||||
Reference in New Issue
Block a user