Browse Source
Fix some clippy warnings and remove unused function
pull/1125/head
Daniel García
4 years ago
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A
2 changed files with
3 additions and
2 deletions
-
src/db/mod.rs
-
src/db/models/cipher.rs
|
@ -136,6 +136,7 @@ macro_rules! db_run { |
|
|
|
|
|
|
|
|
pub trait FromDb { |
|
|
pub trait FromDb { |
|
|
type Output; |
|
|
type Output; |
|
|
|
|
|
#[allow(clippy::wrong_self_convention)] |
|
|
fn from_db(self) -> Self::Output; |
|
|
fn from_db(self) -> Self::Output; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -173,7 +174,7 @@ macro_rules! db_object { |
|
|
)+ } |
|
|
)+ } |
|
|
|
|
|
|
|
|
impl [<$name Db>] { |
|
|
impl [<$name Db>] { |
|
|
#[inline(always)] pub fn from_db(self) -> super::$name { super::$name { $( $field: self.$field, )+ } } |
|
|
#[allow(clippy::wrong_self_convention)]
|
|
|
#[inline(always)] pub fn to_db(x: &super::$name) -> Self { Self { $( $field: x.$field.clone(), )+ } } |
|
|
#[inline(always)] pub fn to_db(x: &super::$name) -> Self { Self { $( $field: x.$field.clone(), )+ } } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
@ -320,7 +320,7 @@ impl Cipher { |
|
|
// and `hide_passwords` columns. This could ideally be done as part
|
|
|
// and `hide_passwords` columns. This could ideally be done as part
|
|
|
// of the query, but Diesel doesn't support a max() or bool_or()
|
|
|
// of the query, but Diesel doesn't support a max() or bool_or()
|
|
|
// function on booleans and this behavior isn't portable anyway.
|
|
|
// function on booleans and this behavior isn't portable anyway.
|
|
|
if let Some(vec) = query.load::<(bool, bool)>(conn).ok() { |
|
|
if let Ok(vec) = query.load::<(bool, bool)>(conn) { |
|
|
let mut read_only = false; |
|
|
let mut read_only = false; |
|
|
let mut hide_passwords = false; |
|
|
let mut hide_passwords = false; |
|
|
for (ro, hp) in vec.iter() { |
|
|
for (ro, hp) in vec.iter() { |
|
|