Fix Clippy warnings

This commit is contained in:
Alex Kotov 2022-09-09 01:38:34 +04:00
parent f69b3add80
commit cebb1adea7
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
4 changed files with 16 additions and 18 deletions

View File

@ -85,6 +85,7 @@ test: $(TEST_EXE)
@echo "$(TEST_EXE)" | awk '{ OFS="\n"; $$1=$$1 } 1' | /bin/sh
$(CARGO) test
$(CARGO) fmt --check
$(CARGO) clippy
clean:
rm -f $(ALL_OBJ) $(ALL_EXE)

View File

@ -105,10 +105,7 @@ unsafe extern "C" fn settings_set_master_area_factor_per_unit(value: c_uchar) {
#[no_mangle]
unsafe extern "C" fn settings_get_max_clients_in_master() -> c_int {
match SETTINGS.unwrap().max_clients_in_master() {
None => 0,
Some(value) => value,
}
SETTINGS.unwrap().max_clients_in_master().unwrap_or(0)
}
#[no_mangle]

View File

@ -86,13 +86,13 @@ impl Default for ForSingleWindow {
}
}
impl Into<c_uchar> for ForSingleWindow {
fn into(self) -> c_uchar {
match self {
Self::Never => 0,
Self::Always => 1,
Self::NotInFullscreen => 2,
Self::NobodyIsFullscreen => 3,
impl From<ForSingleWindow> for c_uchar {
fn from(value: ForSingleWindow) -> Self {
match value {
ForSingleWindow::Never => 0,
ForSingleWindow::Always => 1,
ForSingleWindow::NotInFullscreen => 2,
ForSingleWindow::NobodyIsFullscreen => 3,
}
}
}
@ -176,7 +176,7 @@ impl Settings {
// TODO: notify WM to rearrange clients
pub fn max_clients_in_master_set(&mut self, value: Option<c_int>) {
self.max_clients_in_master =
value.map(|value| constraints::max_clients_in_master(value));
value.map(constraints::max_clients_in_master);
}
pub fn respect_resize_hints_in_floating_layout(&self) -> bool {

View File

@ -7,12 +7,12 @@ pub enum Kind {
Tag,
}
impl Into<c_uchar> for Kind {
fn into(self) -> c_uchar {
match self {
Self::Global => 0,
Self::Monitor => 1,
Self::Tag => 2,
impl From<Kind> for c_uchar {
fn from(value: Kind) -> Self {
match value {
Kind::Global => 0,
Kind::Monitor => 1,
Kind::Tag => 2,
}
}
}