lint passing

This commit is contained in:
EthanShoeDev
2025-09-22 00:35:35 -04:00
parent 9207493bdd
commit 2e9faf0bdc
5 changed files with 32 additions and 11 deletions

View File

@@ -42,6 +42,9 @@
"build:native": "tsx scripts/native-build.ts", "build:native": "tsx scripts/native-build.ts",
"build:bob": "bob build", "build:bob": "bob build",
"lint:rust": "cd rust/uniffi-russh && just lint", "lint:rust": "cd rust/uniffi-russh && just lint",
"lint:rust:check": "cd rust/uniffi-russh && just lint-check",
"fmt:rust": "cd rust/uniffi-russh && just fmt",
"fmt:rust:check": "cd rust/uniffi-russh && just fmt-check",
"update-rust": "cd rust/uniffi-russh && just update-deps", "update-rust": "cd rust/uniffi-russh && just update-deps",
"test": "jest", "test": "jest",
"release": "release-it --only-version" "release": "release-it --only-version"

View File

@@ -4,6 +4,9 @@ default:
@just --list @just --list
lint: lint:
cargo clippy --all-targets --all-features --fix --allow-dirty -- -D warnings
lint-check:
cargo clippy --all-targets --all-features -- -D warnings cargo clippy --all-targets --all-features -- -D warnings
# Update all Cargo dependencies to the latest allowed by Cargo.toml # Update all Cargo dependencies to the latest allowed by Cargo.toml
@@ -16,4 +19,7 @@ test:
fmt: fmt:
cargo fmt cargo fmt
fmt-check:
cargo fmt -- --check

View File

@@ -70,7 +70,6 @@ pub trait ConnectionDisconnectedCallback: Send + Sync {
fn on_change(&self, connection_id: String); fn on_change(&self, connection_id: String);
} }
/// Snapshot of current connection info for property-like access in TS.
#[derive(Debug, Clone, PartialEq, uniffi::Record)] #[derive(Debug, Clone, PartialEq, uniffi::Record)]
pub struct SshConnectionInfo { pub struct SshConnectionInfo {
pub connection_id: String, pub connection_id: String,
@@ -82,8 +81,9 @@ pub struct SshConnectionInfo {
#[derive(uniffi::Object)] #[derive(uniffi::Object)]
pub struct SshConnection { pub struct SshConnection {
pub(crate) info: SshConnectionInfo, pub info: SshConnectionInfo,
pub(crate) on_disconnected_callback: Option<Arc<dyn ConnectionDisconnectedCallback>>, pub on_disconnected_callback: Option<Arc<dyn ConnectionDisconnectedCallback>>,
pub(crate) client_handle: AsyncMutex<ClientHandle<NoopHandler>>, pub(crate) client_handle: AsyncMutex<ClientHandle<NoopHandler>>,
pub(crate) shells: AsyncMutex<HashMap<u32, Arc<ShellSession>>>, pub(crate) shells: AsyncMutex<HashMap<u32, Arc<ShellSession>>>,
@@ -265,7 +265,7 @@ impl SshConnection {
sender: tx, sender: tx,
listener_tasks: Arc::new(Mutex::new(HashMap::new())), listener_tasks: Arc::new(Mutex::new(HashMap::new())),
next_listener_id: AtomicU64::new(1), next_listener_id: AtomicU64::new(1),
default_coalesce_ms, coalesce_ms: default_coalesce_ms,
rt_handle: tokio::runtime::Handle::current(), rt_handle: tokio::runtime::Handle::current(),
}); });

View File

@@ -116,8 +116,8 @@ pub struct ShellSessionInfo {
#[derive(uniffi::Object)] #[derive(uniffi::Object)]
pub struct ShellSession { pub struct ShellSession {
pub(crate) info: ShellSessionInfo, pub info: ShellSessionInfo,
pub(crate) on_closed_callback: Option<Arc<dyn ShellClosedCallback>>, pub on_closed_callback: Option<Arc<dyn ShellClosedCallback>>,
// Weak backref; avoid retain cycle. // Weak backref; avoid retain cycle.
pub(crate) parent: std::sync::Weak<SshConnection>, pub(crate) parent: std::sync::Weak<SshConnection>,
@@ -140,7 +140,7 @@ pub struct ShellSession {
// Listener tasks management // Listener tasks management
pub(crate) listener_tasks: Arc<Mutex<HashMap<u64, tokio::task::JoinHandle<()>>>>, pub(crate) listener_tasks: Arc<Mutex<HashMap<u64, tokio::task::JoinHandle<()>>>>,
pub(crate) next_listener_id: AtomicU64, pub(crate) next_listener_id: AtomicU64,
pub(crate) default_coalesce_ms: AtomicU64, pub(crate) coalesce_ms: AtomicU64,
pub(crate) rt_handle: tokio::runtime::Handle, pub(crate) rt_handle: tokio::runtime::Handle,
} }
@@ -383,7 +383,7 @@ impl ShellSession {
let replay = self.read_buffer(opts.cursor.clone(), None); let replay = self.read_buffer(opts.cursor.clone(), None);
let mut rx = self.sender.subscribe(); let mut rx = self.sender.subscribe();
let id = self.next_listener_id.fetch_add(1, Ordering::Relaxed); let id = self.next_listener_id.fetch_add(1, Ordering::Relaxed);
let default_coalesce_ms = self.default_coalesce_ms.load(Ordering::Relaxed) as u32; let default_coalesce_ms = self.coalesce_ms.load(Ordering::Relaxed) as u32;
let coalesce_ms = opts.coalesce_ms.unwrap_or(default_coalesce_ms); let coalesce_ms = opts.coalesce_ms.unwrap_or(default_coalesce_ms);
let rt = self.rt_handle.clone(); let rt = self.rt_handle.clone();

View File

@@ -3,13 +3,22 @@
"extends": ["//"], "extends": ["//"],
"tasks": { "tasks": {
// Default overrides // Default overrides
"fmt": { "with": ["//#fmt:root", "fmt:rust"] },
"fmt:check": { "with": ["//#fmt:check:root", "fmt:rust:check"] },
"lint": { "lint": {
"dependsOn": ["fmt", "^build", "build:bob"], "dependsOn": ["fmt", "^build", "build:bob", "fmt:rust"],
"with": ["typecheck", "//#lint:root", "lint:rust"], "with": ["typecheck", "//#lint:root", "lint:rust"],
}, },
"lint:check": { "lint:check": {
"dependsOn": ["^build", "build:bob"], "dependsOn": ["^build", "build:bob"],
"with": ["fmt:check", "typecheck", "//#lint:check:root", "lint:rust"], "with": [
"fmt:check",
"typecheck",
"//#lint:check:root",
"lint:rust",
"lint:rust:check",
"fmt:rust:check",
],
}, },
"build": { "build": {
"dependsOn": ["build:bob"], "dependsOn": ["build:bob"],
@@ -20,6 +29,9 @@
// Special tasks // Special tasks
"lint:rust": {}, "lint:rust": {},
"lint:rust:check": {},
"fmt:rust": {},
"fmt:rust:check": {},
"build:bob": { "build:bob": {
"dependsOn": ["build:native"], "dependsOn": ["build:native"],
"inputs": ["src/**"], "inputs": ["src/**"],