Skip to content

Commit 446fbc6

Browse files
committed
cleanup
1 parent 64ac20d commit 446fbc6

File tree

6 files changed

+33
-20
lines changed

6 files changed

+33
-20
lines changed

build.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,27 @@ fn resolve_git_dir() -> Option<PathBuf> {
4343
return Some(dot_git);
4444
}
4545

46-
if dot_git.is_file()
47-
&& let Ok(contents) = fs::read_to_string(&dot_git)
48-
&& let Some(rest) = contents.strip_prefix("gitdir:")
49-
{
50-
let mut resolved = PathBuf::from(rest.trim());
51-
if resolved.is_relative()
52-
&& let Some(parent) = dot_git.parent()
53-
{
54-
resolved = parent.join(resolved);
46+
if dot_git.is_file() {
47+
if let Ok(contents) = fs::read_to_string(&dot_git) {
48+
if let Some(rest) = contents.strip_prefix("gitdir:") {
49+
let mut resolved = PathBuf::from(rest.trim());
50+
if resolved.is_relative() {
51+
if let Some(parent) = dot_git.parent() {
52+
resolved = parent.join(resolved);
53+
}
54+
}
55+
return Some(resolved);
56+
}
5557
}
56-
return Some(resolved);
5758
}
5859

5960
None
6061
}
6162

6263
fn emit_rerun(path: &Path) {
63-
if path.exists()
64-
&& let Some(display) = path.to_str()
65-
{
66-
println!("cargo:rerun-if-changed={display}");
64+
if path.exists() {
65+
if let Some(display) = path.to_str() {
66+
println!("cargo:rerun-if-changed={display}");
67+
}
6768
}
6869
}

clean.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Format and lint the project with all features.
3+
set -euo pipefail
4+
5+
# Format first so clippy runs on the normalized code.
6+
cargo fmt
7+
8+
# Lint everything with all features.
9+
cargo clippy --workspace --all-features
10+
11+
echo "✅ fmt + clippy completed"

configurator/src/models/fields.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl StatusPositionOption {
143143
}
144144
}
145145

146+
#[allow(clippy::wrong_self_convention)]
146147
pub fn to_status_position(&self) -> StatusPosition {
147148
match self {
148149
StatusPositionOption::TopLeft => StatusPosition::TopLeft,
@@ -305,6 +306,7 @@ impl SessionStorageModeOption {
305306
}
306307
}
307308

309+
#[allow(clippy::wrong_self_convention)]
308310
pub fn to_mode(&self) -> SessionStorageMode {
309311
match self {
310312
Self::Auto => SessionStorageMode::Auto,
@@ -348,6 +350,7 @@ impl SessionCompressionOption {
348350
}
349351
}
350352

353+
#[allow(clippy::wrong_self_convention)]
351354
pub fn to_compression(&self) -> SessionCompression {
352355
match self {
353356
Self::Auto => SessionCompression::Auto,

src/backend/wayland/toolbar.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ fn draw_tooltip(
10721072
ctx.select_font_face("Sans", cairo::FontSlant::Normal, cairo::FontWeight::Normal);
10731073
ctx.set_font_size(12.0);
10741074

1075-
if let Ok(ext) = ctx.text_extents(&text) {
1075+
if let Ok(ext) = ctx.text_extents(text) {
10761076
let pad = 6.0;
10771077
let tooltip_w = ext.width() + pad * 2.0;
10781078
let tooltip_h = ext.height() + pad * 2.0;
@@ -1127,7 +1127,7 @@ fn draw_tooltip(
11271127
tooltip_x + pad - ext.x_bearing(),
11281128
tooltip_y + pad - ext.y_bearing(),
11291129
);
1130-
let _ = ctx.show_text(&text);
1130+
let _ = ctx.show_text(text);
11311131
}
11321132
break;
11331133
}
@@ -2198,7 +2198,7 @@ fn draw_button(ctx: &cairo::Context, x: f64, y: f64, w: f64, h: f64, active: boo
21982198
}
21992199

22002200
fn draw_label_center(ctx: &cairo::Context, x: f64, y: f64, w: f64, h: f64, text: &str) {
2201-
if let Ok(ext) = ctx.text_extents(&text) {
2201+
if let Ok(ext) = ctx.text_extents(text) {
22022202
let tx = x + (w - ext.width()) / 2.0 - ext.x_bearing();
22032203
let ty = y + (h - ext.height()) / 2.0 - ext.y_bearing();
22042204
ctx.set_source_rgba(1.0, 1.0, 1.0, 0.95);
@@ -2208,7 +2208,7 @@ fn draw_label_center(ctx: &cairo::Context, x: f64, y: f64, w: f64, h: f64, text:
22082208
}
22092209

22102210
fn draw_label_left(ctx: &cairo::Context, x: f64, y: f64, _w: f64, h: f64, text: &str) {
2211-
if let Ok(ext) = ctx.text_extents(&text) {
2211+
if let Ok(ext) = ctx.text_extents(text) {
22122212
let ty = y + (h - ext.height()) / 2.0 - ext.y_bearing();
22132213
ctx.set_source_rgba(1.0, 1.0, 1.0, 0.95);
22142214
ctx.move_to(x, ty);

src/capture/portal.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg(feature = "portal")]
21
//! xdg-desktop-portal integration for screenshot capture.
32
43
use super::types::{CaptureError, CaptureType};

src/capture/sources/portal.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg(feature = "portal")]
21
use crate::capture::{
32
portal,
43
types::{CaptureError, CaptureType},

0 commit comments

Comments
 (0)