1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 23:01:04 +02:00

refactor: fix some pedantic clippy warnings

This commit is contained in:
Jake Stanger 2024-08-14 21:23:28 +01:00
parent 4d30819ff6
commit 04f45ccae1
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
12 changed files with 43 additions and 46 deletions

View file

@ -74,7 +74,7 @@ impl Module<gtk::Box> for CairoModule {
where
<Self as Module<gtk::Box>>::SendMessage: Clone,
{
let path = self.path.to_path_buf();
let path = self.path.clone();
let tx = context.tx.clone();
spawn(async move {
@ -160,16 +160,14 @@ impl Module<gtk::Box> for CairoModule {
let ptr = unsafe { cr.clone().into_glib_ptr().cast() };
// mlua needs a valid return type, even if we don't return anything
if let Err(err) =
function.call::<_, Option<bool>>((id.as_str(), LightUserData(ptr)))
{
match err {
Error::RuntimeError(message) => {
let message = message.split_once("]:").expect("to exist").1;
error!("[lua runtime error] {}:{message}", path.display())
}
_ => error!("{err}"),
if let Error::RuntimeError(message) = err {
let message = message.split_once("]:").expect("to exist").1;
error!("[lua runtime error] {}:{message}", path.display());
} else {
error!("{err}");
}
return Propagation::Stop;
@ -196,10 +194,10 @@ impl Module<gtk::Box> for CairoModule {
match res {
Ok(script) => {
match lua.load(&script).exec() {
Ok(_) => {},
Ok(()) => {},
Err(Error::SyntaxError { message, ..}) => {
let message = message.split_once("]:").expect("to exist").1;
error!("[lua syntax error] {}:{message}", self.path.display())
error!("[lua syntax error] {}:{message}", self.path.display());
},
Err(err) => error!("lua error: {err:?}")
}

View file

@ -70,10 +70,10 @@ impl Module<Label> for SwayModeModule {
let on_mode = move |mode: ModeEvent| {
trace!("mode: {:?}", mode);
label.set_use_markup(mode.pango_markup);
if mode.change != "default" {
label.set_markup(&mode.change)
} else {
if mode.change == "default" {
label.set_markup("");
} else {
label.set_markup(&mode.change);
}
};

View file

@ -33,7 +33,7 @@ pub struct SysInfoModule {
/// The orientation of text for the labels.
///
/// **Valid options**: `horizontal`, `vertical, `h`, `v`
/// **Valid options**: `horizontal`, `vertical`, `h`, `v`
/// <br>
/// **Default** : `horizontal`
#[serde(default)]
@ -41,7 +41,7 @@ pub struct SysInfoModule {
/// The orientation by which the labels are laid out.
///
/// **Valid options**: `horizontal`, `vertical, `h`, `v`
/// **Valid options**: `horizontal`, `vertical`, `h`, `v`
/// <br>
/// **Default** : `horizontal`
direction: Option<ModuleOrientation>,

View file

@ -94,7 +94,7 @@ fn get_image_from_pixmap(item: &TrayMenu, size: u32) -> Result<Image> {
return Err(Report::msg("empty pixmap"));
}
let mut pixels = pixmap.pixels.to_vec();
let mut pixels = pixmap.pixels.clone();
for i in (0..pixels.len()).step_by(4) {
let alpha = pixels[i];