address clippy lints

This commit is contained in:
Ferdinand Schober
2023-12-10 15:23:57 +01:00
parent 5c8ea25563
commit ebf5a64f20
13 changed files with 116 additions and 117 deletions

View File

@@ -63,7 +63,7 @@ impl ClientRow {
let port_binding = client_object
.bind_property("port", &self.imp().port.get(), "text")
.transform_from(|_, v: String| {
if v == "" {
if v.is_empty() {
Some(DEFAULT_PORT as u32)
} else {
Some(v.parse::<u16>().unwrap_or(DEFAULT_PORT) as u32)

View File

@@ -85,16 +85,13 @@ impl Window {
}
pub fn client_idx(&self, handle: ClientHandle) -> Option<usize> {
self.clients()
.iter::<ClientObject>()
.position(|c| {
if let Ok(c) = c {
c.handle() == handle
} else {
false
}
})
.map(|p| p as usize)
self.clients().iter::<ClientObject>().position(|c| {
if let Ok(c) = c {
c.handle() == handle
} else {
false
}
})
}
pub fn delete_client(&self, handle: ClientHandle) {
@@ -117,7 +114,7 @@ impl Window {
pub fn request_port_change(&self) {
let port = self.imp().port_entry.get().text().to_string();
if let Ok(port) = u16::from_str_radix(port.as_str(), 10) {
if let Ok(port) = port.as_str().parse::<u16>() {
self.request(FrontendEvent::ChangePort(port));
} else {
self.request(FrontendEvent::ChangePort(DEFAULT_PORT));