Skip to content

Commit

Permalink
chore(clippy): update lints
Browse files Browse the repository at this point in the history
  • Loading branch information
saying121 committed Aug 29, 2024
1 parent 8f45267 commit b76694e
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 273 deletions.
399 changes: 139 additions & 260 deletions Cargo.toml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions crates/decrypt-cookies/src/browser/cookies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
#[derive(Debug)]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
#[non_exhaustive]
pub struct LeetCodeCookies {
pub csrf: String,
pub session: String,
Expand Down
1 change: 1 addition & 0 deletions crates/decrypt-cookies/src/browser/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ pub mod linux {
use super::{ChromiumInfo, FfInfo, TempPath};
use crate::Browser;

#[allow(clippy::exhaustive_structs)]
#[derive(Clone)]
#[derive(Debug)]
#[derive(Default)]
Expand Down
1 change: 1 addition & 0 deletions crates/decrypt-cookies/src/chromium/crypto/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{browser::info::need_safe_storage, Browser};
// const K_DERIVED_KEY_SIZE_IN_BITS: u32 = 128;
type Aes128CbcDec = cbc::Decryptor<aes::Aes128>;

#[allow(clippy::empty_line_after_doc_comments)]
// https://source.chromium.org/chromium/chromium/src/+/main:components/os_crypt/sync/os_crypt_linux.cc;l=50
/// The UMA metric name for whether the false was decryptable with an empty key.
// const K_METRIC_DECRYPTED_WITH_EMPTY_KEY: &[u8] = b"OSCrypt.Linux.DecryptedWithEmptyKey";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct CookiesQuery {

impl CookiesQuery {
/// * `browser`: `edge`, `chrome`
pub async fn new<P: AsRef<Path>>(path: P) -> Result<Self> {
pub async fn new<P: AsRef<Path> + Send>(path: P) -> Result<Self> {
let db_conn_str = format!("sqlite:{}?mode=rwc", path.as_ref().to_string_lossy());

let db = Database::connect(db_conn_str)
Expand All @@ -31,7 +31,7 @@ impl CookiesQuery {
/// get raw Cookies
pub async fn query_cookie_filter<F>(&self, filter: F) -> Result<Vec<Model>>
where
F: IntoCondition,
F: IntoCondition + Send,
{
CookiesDB::find()
.filter(filter)
Expand Down
1 change: 1 addition & 0 deletions crates/decrypt-cookies/src/chromium/items/cookie/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::browser::cookies::{CookiesInfo, SameSite};
pub mod cookie_dao;
pub mod cookie_entities;

#[allow(clippy::exhaustive_structs)]
#[derive(Clone)]
#[derive(Debug)]
#[derive(PartialEq, Eq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct LoginDataQuery {
}

impl LoginDataQuery {
pub async fn new<P: AsRef<Path>>(path: P) -> Result<Self> {
pub async fn new<P: AsRef<Path> + Send>(path: P) -> Result<Self> {
let db_conn_str = format!("sqlite:{}?mode=rwc", path.as_ref().to_string_lossy());

let db = Database::connect(db_conn_str)
Expand All @@ -29,7 +29,7 @@ impl LoginDataQuery {
/// filter login data
pub async fn query_login_dt_filter<F>(&self, filter: F) -> Result<Vec<logins::Model>>
where
F: IntoCondition,
F: IntoCondition + Send,
{
Logins::find()
.filter(filter)
Expand Down
1 change: 1 addition & 0 deletions crates/decrypt-cookies/src/chromium/items/passwd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use super::I64ToChromiumDateTime;
pub mod login_data_dao;
pub mod login_data_entities;

#[non_exhaustive]
#[derive(Clone)]
#[derive(Debug)]
#[derive(PartialEq, Eq)]
Expand Down
1 change: 1 addition & 0 deletions crates/decrypt-cookies/src/chromium/local_state.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::exhaustive_structs)]
use serde::{Deserialize, Serialize};

#[derive(Clone)]
Expand Down
13 changes: 8 additions & 5 deletions crates/decrypt-cookies/src/chromium/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl ChromiumGetter {
/// ```
pub async fn get_logins_filter<F>(&self, filter: F) -> Result<Vec<LoginData>>
where
F: IntoCondition,
F: IntoCondition + Send,
{
let raw_login = self
.login_data_query
Expand All @@ -238,7 +238,7 @@ impl ChromiumGetter {
/// contains passwords
pub async fn get_logins_by_host<F>(&self, host: F) -> Result<Vec<LoginData>>
where
F: AsRef<str>,
F: AsRef<str> + Send,
{
let raw_login = self
.login_data_query
Expand Down Expand Up @@ -281,7 +281,7 @@ impl ChromiumGetter {
/// ```
pub async fn get_cookies_filter<F>(&self, filter: F) -> Result<Vec<ChromiumCookie>>
where
F: IntoCondition,
F: IntoCondition + Send,
{
let raw_ck = self
.cookies_query
Expand All @@ -290,7 +290,10 @@ impl ChromiumGetter {
self.par_decrypt_ck(raw_ck).await
}
/// decrypt Cookies
pub async fn get_cookies_by_host<A: AsRef<str>>(&self, host: A) -> Result<Vec<ChromiumCookie>> {
pub async fn get_cookies_by_host<A: AsRef<str> + Send>(
&self,
host: A,
) -> Result<Vec<ChromiumCookie>> {
let raw_ck = self
.cookies_query
.query_cookie_by_host(host.as_ref())
Expand All @@ -308,7 +311,7 @@ impl ChromiumGetter {
}

/// get `LEETCODE_SESSION` and `csrftoken` for leetcode
pub async fn get_cookies_session_csrf<A: AsRef<str>>(
pub async fn get_cookies_session_csrf<A: AsRef<str> + Send>(
&self,
host: A,
) -> Result<LeetCodeCookies> {
Expand Down
4 changes: 2 additions & 2 deletions crates/decrypt-cookies/src/firefox/items/cookie/dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct CookiesQuery {
impl CookiesQuery {
pub async fn new<P>(path: P) -> miette::Result<Self>
where
P: AsRef<Path>,
P: AsRef<Path> + Send,
{
let db_conn_str = format!("sqlite:{}?mode=rwc", path.as_ref().to_string_lossy());

Expand All @@ -36,7 +36,7 @@ impl CookiesQuery {

pub async fn query_cookie_filter<F>(&self, filter: F) -> Result<Vec<Model>>
where
F: IntoCondition,
F: IntoCondition + Send,
{
let res = MozCookies::find()
.filter(filter)
Expand Down
3 changes: 3 additions & 0 deletions crates/decrypt-cookies/src/firefox/items/cookie/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::exhaustive_structs)]

use chrono::{DateTime, Utc};

use self::entities::moz_cookies;
Expand All @@ -10,6 +12,7 @@ pub mod entities;
#[derive(Clone)]
#[derive(Debug)]
#[derive(PartialEq, Eq)]
#[non_exhaustive]
pub struct MozCookies {
pub id: i32,
pub origin_attributes: String,
Expand Down
2 changes: 1 addition & 1 deletion crates/decrypt-cookies/src/firefox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl FirefoxGetter {
/// ```
pub async fn get_cookies_filter<F>(&self, filter: F) -> Result<Vec<MozCookies>>
where
F: IntoCondition,
F: IntoCondition + Send,
{
let res = self
.cookies_query
Expand Down
2 changes: 1 addition & 1 deletion crates/decrypt-cookies/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cfg_if::cfg_if!(
/// * `borwser`: Firefox, Librewolf, edge, chrome
pub async fn get_cookie<T>(browser: T, host: &str) -> Result<LeetCodeCookies>
where
T: Into<Browser> + Clone,
T: Into<Browser> + Clone + Send,
{
let res = match browser.clone().into() {
Browser::Firefox | Browser::Librewolf => {
Expand Down

0 comments on commit b76694e

Please sign in to comment.