1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-01 18:51:04 +02:00

refactor: fix new pedantic clippy warnings

This commit is contained in:
Jake Stanger 2023-07-16 20:09:22 +01:00
parent 36abe4073e
commit 06251e293e
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
4 changed files with 10 additions and 24 deletions

View file

@ -148,7 +148,7 @@ Responds with `ok` if the popup exists, otherwise `error`.
```json ```json
{ {
"type": "toggle_popup", "type": "toggle_popup",
"bar_name": "DP-2-13", "bar_name": "bar-123",
"name": "clock" "name": "clock"
} }
``` ```
@ -163,7 +163,7 @@ Responds with `ok` if the popup exists, otherwise `error`.
```json ```json
{ {
"type": "open_popup", "type": "open_popup",
"bar_name": "DP-2-13", "bar_name": "bar-123",
"name": "clock" "name": "clock"
} }
``` ```
@ -176,8 +176,8 @@ Responds with `ok` if the popup exists, otherwise `error`.
```json ```json
{ {
"type": "toggle_popup", "type": "close_popup",
"bar_name": "DP-2-13" "bar_name": "bar-123"
} }
``` ```

View file

@ -315,22 +315,6 @@ impl DataControlSourceHandler for Environment {
} }
} }
} }
// for chunk in bytes.chunks(pipe_size as usize) {
// trace!("Writing chunk");
// file.write(chunk).expect("Failed to write chunk to buffer");
// file.flush().expect("Failed to flush to file");
// }
// match file.write_vectored(&bytes.chunks(pipe_size as usize).map(IoSlice::new).collect::<Vec<_>>()) {
// Ok(_) => debug!("Copied item"),
// Err(err) => error!("{err:?}"),
// }
// match file.write_all(bytes) {
// Ok(_) => debug!("Copied item"),
// Err(err) => error!("{err:?}"),
// }
} else { } else {
error!("Failed to find source"); error!("Failed to find source");
} }
@ -375,11 +359,14 @@ fn set_pipe_size(fd: RawFd, size: usize) -> io::Result<i32> {
let new_size = if size > curr_size { let new_size = if size > curr_size {
trace!("Requesting pipe size increase to (at least): {size}"); trace!("Requesting pipe size increase to (at least): {size}");
let res = fcntl(fd, F_SETPIPE_SZ(size as i32))?; let res = fcntl(fd, F_SETPIPE_SZ(size as i32))?;
trace!("New pipe size: {res}"); trace!("New pipe size: {res}");
if res < size as i32 { if res < size as i32 {
return Err(io::Error::last_os_error()); return Err(io::Error::last_os_error());
} }
res res
} else { } else {
size as i32 size as i32

View file

@ -123,9 +123,9 @@ impl Default for Config {
} }
Self { Self {
position: Default::default(), position: BarPosition::default(),
height: default_bar_height(), height: default_bar_height(),
margin: Default::default(), margin: MarginConfig::default(),
name: None, name: None,
popup_gap: default_popup_gap(), popup_gap: default_popup_gap(),
icon_theme: None, icon_theme: None,

View file

@ -59,8 +59,7 @@ fn default_popup_format() -> String {
fn default_locale() -> String { fn default_locale() -> String {
env::var("LC_TIME") env::var("LC_TIME")
.or_else(|_| env::var("LANG")) .or_else(|_| env::var("LANG"))
.map(strip_tail) .map_or_else(|_| "POSIX".to_string(), strip_tail)
.unwrap_or_else(|_| "POSIX".to_string())
} }
fn strip_tail(string: String) -> String { fn strip_tail(string: String) -> String {