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 @echo "$(TEST_EXE)" | awk '{ OFS="\n"; $$1=$$1 } 1' | /bin/sh
$(CARGO) test $(CARGO) test
$(CARGO) fmt --check $(CARGO) fmt --check
$(CARGO) clippy
clean: clean:
rm -f $(ALL_OBJ) $(ALL_EXE) 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] #[no_mangle]
unsafe extern "C" fn settings_get_max_clients_in_master() -> c_int { unsafe extern "C" fn settings_get_max_clients_in_master() -> c_int {
match SETTINGS.unwrap().max_clients_in_master() { SETTINGS.unwrap().max_clients_in_master().unwrap_or(0)
None => 0,
Some(value) => value,
}
} }
#[no_mangle] #[no_mangle]

View file

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

View file

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