Fix some errors and warnings when enabling/disabling features (#821)

* Fix E&Ws when enabling features

* `share_clipboard` feature can be disabled more cleanly

* `notify` feature can be disabled more cleanly
This commit is contained in:
cyqsimon
2022-06-11 03:32:59 +08:00
committed by GitHub
parent ce6b360cba
commit fefbd4191d
8 changed files with 48 additions and 36 deletions

View File

@@ -14,7 +14,7 @@ use {
#[cfg(feature = "share_selection")]
use clipboard::{x11_clipboard, x11_clipboard::X11ClipboardContext};
#[cfg(feature = "share_selection")]
#[cfg(all(feature = "share_selection", feature = "wayland_clipboard"))]
use wl_clipboard_rs::utils::{is_primary_selection_supported, PrimarySelectionCheckError};
#[cfg(not(feature = "share_selection"))]
@@ -80,8 +80,8 @@ pub fn read_share() -> Option<String> {
#[cfg(feature = "wayland_clipboard")]
{
//use wayland clipboard
match is_primary_selection_supported() {
Ok(supported) => {
string = match is_primary_selection_supported() {
Ok(_supported) => {
let result = get_contents(
paste::ClipboardType::Primary,
Seat::Unspecified,
@@ -124,11 +124,7 @@ pub fn read_share() -> Option<String> {
}
}
}
if let Some(s) = string {
Some(s)
} else {
None
}
string
} else {
//use x11 clipboard
ClipboardProvider::new()