Fix code quality: trailing whitespace, unused imports, clippy warnings
- Fix trailing whitespace in kex.rs and s3.rs - Add missing KexProposal import in kex_complete.rs - Auto-fix clippy warnings across all crates - All 153 tests pass
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::path::PathBuf;
|
||||
use rusqlite::{Connection, params};
|
||||
use bcrypt::verify;
|
||||
use super::{DataProvider, ProviderError, User};
|
||||
use bcrypt::verify;
|
||||
use rusqlite::{params, Connection};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// SQLite 数据提供者
|
||||
pub struct SqliteProvider {
|
||||
@@ -13,7 +13,8 @@ impl SqliteProvider {
|
||||
let path = PathBuf::from(db_path);
|
||||
if !path.exists() {
|
||||
return Err(ProviderError::NotFound(format!(
|
||||
"Database not found: {}", db_path
|
||||
"Database not found: {}",
|
||||
db_path
|
||||
)));
|
||||
}
|
||||
Ok(Self { db_path: path })
|
||||
@@ -50,7 +51,8 @@ impl DataProvider for SqliteProvider {
|
||||
Ok(user) => Ok(Some(user)),
|
||||
Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None),
|
||||
Err(e) => Err(ProviderError::Internal(format!(
|
||||
"Database query error: {}", e
|
||||
"Database query error: {}",
|
||||
e
|
||||
))),
|
||||
}
|
||||
}
|
||||
@@ -66,7 +68,9 @@ impl DataProvider for SqliteProvider {
|
||||
}
|
||||
|
||||
fn get_home_dir(&self, username: &str) -> Result<Option<String>, ProviderError> {
|
||||
Ok(self.get_user(username)?.map(|u| u.home_dir.to_string_lossy().to_string()))
|
||||
Ok(self
|
||||
.get_user(username)?
|
||||
.map(|u| u.home_dir.to_string_lossy().to_string()))
|
||||
}
|
||||
|
||||
fn get_public_keys(&self, username: &str) -> Result<Vec<String>, ProviderError> {
|
||||
@@ -98,7 +102,10 @@ mod tests {
|
||||
}
|
||||
|
||||
fn get_test_db_path() -> String {
|
||||
format!("{}/../data/auth.sqlite", std::env::var("CARGO_MANIFEST_DIR").unwrap())
|
||||
format!(
|
||||
"{}/../data/auth.sqlite",
|
||||
std::env::var("CARGO_MANIFEST_DIR").unwrap()
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user