styling fix and clippy fixes

This commit is contained in:
Samuel Onoja committed 2026-10-01 08:59:00 +01:00
1 parent 1364ff62b8
commit 4137f787bf
17 files changed
+123 -75

No files matched your search

+2 -2
View File
@@ -702,7 +702,7 @@ fn update_wallpaper(image: &Path, target: &str) -> Result<(), String> {
}
fn edit_wallpaper(path: &Path, image: &Path, target: &str) -> Result<(), String> {
let source = match std::fs::read_to_string(&path) {
let source = match std::fs::read_to_string(path) {
Ok(source) => source,
Err(error) if error.kind() == std::io::ErrorKind::NotFound => String::new(),
Err(error) => return Err(error.to_string()),
@@ -736,7 +736,7 @@ fn edit_wallpaper(path: &Path, image: &Path, target: &str) -> Result<(), String>
let mut temp = tempfile::NamedTempFile::new_in(parent).map_err(|error| error.to_string())?;
std::io::Write::write_all(&mut temp, document.to_string().as_bytes()).map_err(|error| error.to_string())?;
temp.as_file().sync_all().map_err(|error| error.to_string())?;
if std::fs::read_to_string(&path).unwrap_or_default() != source {
if std::fs::read_to_string(path).unwrap_or_default() != source {
return Err("Configuration changed; please try again".into());
}
temp.persist(path).map_err(|error| error.to_string())?;
+6 -8
View File
@@ -148,17 +148,16 @@ impl Inhibit {
("screensaver-active".into(), Value::from(locked).try_into().unwrap()),
("session-state".into(), Value::from(phase).try_into().unwrap()),
]);
if let Ok(emitter) = SignalEmitter::new(&connection, PATH) {
if Self::state_changed(
if let Ok(emitter) = SignalEmitter::new(&connection, PATH)
&& Self::state_changed(
&emitter,
OwnedObjectPath::try_from(path.clone()).unwrap(),
values,
)
.await
.is_err()
{
break;
}
{
break;
}
}
*last = Some((locked, phase, revision, token));
@@ -344,7 +343,7 @@ impl Inhibit {
{
Ok(2)
} else {
let attempt = async {
async {
let bridge = Bridge::connect().map_err(zbus::fdo::Error::Failed)?;
let result = tokio::select! {
biased;
@@ -403,8 +402,7 @@ impl Inhibit {
}
}
}
.await;
attempt
.await
};
drop(monitors);
self.requests.end(connection, &handle).await;
+3 -5
View File
@@ -165,13 +165,11 @@ impl InputCapture {
if let Some(position) = event["cursor_position"]
.as_array()
.filter(|position| position.len() == 2)
{
if let Ok(position) =
&& let Ok(position) =
Value::from((position[0].as_f64().unwrap_or(0.0), position[1].as_f64().unwrap_or(0.0)))
.try_to_owned()
{
options.insert("cursor_position".into(), position);
}
{
options.insert("cursor_position".into(), position);
}
Self::activated(&emitter, path.clone(), options).await
}
+4 -4
View File
@@ -128,10 +128,10 @@ impl Settings {
}
async fn read(&self, namespace: &str, key: &str) -> zbus::fdo::Result<OwnedValue> {
if namespace == APPEARANCE {
if let Some(value) = self.0.read().await.values().remove(key) {
return Ok(value);
}
if namespace == APPEARANCE
&& let Some(value) = self.0.read().await.values().remove(key)
{
return Ok(value);
}
Err(zbus::fdo::Error::InvalidArgs("Unknown setting".into()))
}