mirror of
https://github.com/devmobasa/wayscriber.git
synced 2026-06-03 03:54:42 +02:00
cleanup
This commit is contained in:
@@ -43,26 +43,27 @@ fn resolve_git_dir() -> Option<PathBuf> {
|
||||
return Some(dot_git);
|
||||
}
|
||||
|
||||
if dot_git.is_file()
|
||||
&& let Ok(contents) = fs::read_to_string(&dot_git)
|
||||
&& let Some(rest) = contents.strip_prefix("gitdir:")
|
||||
{
|
||||
let mut resolved = PathBuf::from(rest.trim());
|
||||
if resolved.is_relative()
|
||||
&& let Some(parent) = dot_git.parent()
|
||||
{
|
||||
resolved = parent.join(resolved);
|
||||
if dot_git.is_file() {
|
||||
if let Ok(contents) = fs::read_to_string(&dot_git) {
|
||||
if let Some(rest) = contents.strip_prefix("gitdir:") {
|
||||
let mut resolved = PathBuf::from(rest.trim());
|
||||
if resolved.is_relative() {
|
||||
if let Some(parent) = dot_git.parent() {
|
||||
resolved = parent.join(resolved);
|
||||
}
|
||||
}
|
||||
return Some(resolved);
|
||||
}
|
||||
}
|
||||
return Some(resolved);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn emit_rerun(path: &Path) {
|
||||
if path.exists()
|
||||
&& let Some(display) = path.to_str()
|
||||
{
|
||||
println!("cargo:rerun-if-changed={display}");
|
||||
if path.exists() {
|
||||
if let Some(display) = path.to_str() {
|
||||
println!("cargo:rerun-if-changed={display}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Format and lint the project with all features.
|
||||
set -euo pipefail
|
||||
|
||||
# Format first so clippy runs on the normalized code.
|
||||
cargo fmt
|
||||
|
||||
# Lint everything with all features.
|
||||
cargo clippy --workspace --all-features
|
||||
|
||||
echo "✅ fmt + clippy completed"
|
||||
@@ -143,6 +143,7 @@ impl StatusPositionOption {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn to_status_position(&self) -> StatusPosition {
|
||||
match self {
|
||||
StatusPositionOption::TopLeft => StatusPosition::TopLeft,
|
||||
@@ -305,6 +306,7 @@ impl SessionStorageModeOption {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn to_mode(&self) -> SessionStorageMode {
|
||||
match self {
|
||||
Self::Auto => SessionStorageMode::Auto,
|
||||
@@ -348,6 +350,7 @@ impl SessionCompressionOption {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn to_compression(&self) -> SessionCompression {
|
||||
match self {
|
||||
Self::Auto => SessionCompression::Auto,
|
||||
|
||||
@@ -1072,7 +1072,7 @@ fn draw_tooltip(
|
||||
ctx.select_font_face("Sans", cairo::FontSlant::Normal, cairo::FontWeight::Normal);
|
||||
ctx.set_font_size(12.0);
|
||||
|
||||
if let Ok(ext) = ctx.text_extents(&text) {
|
||||
if let Ok(ext) = ctx.text_extents(text) {
|
||||
let pad = 6.0;
|
||||
let tooltip_w = ext.width() + pad * 2.0;
|
||||
let tooltip_h = ext.height() + pad * 2.0;
|
||||
@@ -1127,7 +1127,7 @@ fn draw_tooltip(
|
||||
tooltip_x + pad - ext.x_bearing(),
|
||||
tooltip_y + pad - ext.y_bearing(),
|
||||
);
|
||||
let _ = ctx.show_text(&text);
|
||||
let _ = ctx.show_text(text);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2198,7 +2198,7 @@ fn draw_button(ctx: &cairo::Context, x: f64, y: f64, w: f64, h: f64, active: boo
|
||||
}
|
||||
|
||||
fn draw_label_center(ctx: &cairo::Context, x: f64, y: f64, w: f64, h: f64, text: &str) {
|
||||
if let Ok(ext) = ctx.text_extents(&text) {
|
||||
if let Ok(ext) = ctx.text_extents(text) {
|
||||
let tx = x + (w - ext.width()) / 2.0 - ext.x_bearing();
|
||||
let ty = y + (h - ext.height()) / 2.0 - ext.y_bearing();
|
||||
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:
|
||||
}
|
||||
|
||||
fn draw_label_left(ctx: &cairo::Context, x: f64, y: f64, _w: f64, h: f64, text: &str) {
|
||||
if let Ok(ext) = ctx.text_extents(&text) {
|
||||
if let Ok(ext) = ctx.text_extents(text) {
|
||||
let ty = y + (h - ext.height()) / 2.0 - ext.y_bearing();
|
||||
ctx.set_source_rgba(1.0, 1.0, 1.0, 0.95);
|
||||
ctx.move_to(x, ty);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#![cfg(feature = "portal")]
|
||||
//! xdg-desktop-portal integration for screenshot capture.
|
||||
|
||||
use super::types::{CaptureError, CaptureType};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#![cfg(feature = "portal")]
|
||||
use crate::capture::{
|
||||
portal,
|
||||
types::{CaptureError, CaptureType},
|
||||
|
||||
Reference in New Issue
Block a user