fix(rpc): fix a bunch of clippy lints (#10493)
* fix(rpc): fix a bunch of clippy lints * fix(rpc clippy): remove unused ignored lints * fix(clippy): fix all redundant_field_names This commit fixes all uses of `redundant_field_names` and removes the ignored lint `redundant_field_names` * fix(brain unwrap): replace with expect
This commit is contained in:
committed by
Hernando Castano
parent
f2c34f7ca2
commit
17042e9c32
@@ -51,7 +51,7 @@ const TIME_THRESHOLD: u64 = 7;
|
||||
/// minimal length of hash
|
||||
const TOKEN_LENGTH: usize = 16;
|
||||
/// Separator between fields in serialized tokens file.
|
||||
const SEPARATOR: &'static str = ";";
|
||||
const SEPARATOR: &str = ";";
|
||||
/// Number of seconds to keep unused tokens.
|
||||
const UNUSED_TOKEN_TIMEOUT: u64 = 3600 * 24; // a day
|
||||
|
||||
@@ -115,7 +115,7 @@ impl AuthCodes<DefaultTimeProvider> {
|
||||
})
|
||||
.collect();
|
||||
Ok(AuthCodes {
|
||||
codes: codes,
|
||||
codes,
|
||||
now: time_provider,
|
||||
})
|
||||
}
|
||||
@@ -128,7 +128,7 @@ impl<T: TimeProvider> AuthCodes<T> {
|
||||
pub fn to_file(&self, file: &Path) -> io::Result<()> {
|
||||
let mut file = fs::File::create(file)?;
|
||||
let content = self.codes.iter().map(|code| {
|
||||
let mut data = vec![code.code.clone(), encode_time(code.created_at.clone())];
|
||||
let mut data = vec![code.code.clone(), encode_time(code.created_at)];
|
||||
if let Some(used_at) = code.last_used_at {
|
||||
data.push(encode_time(used_at));
|
||||
}
|
||||
@@ -141,11 +141,11 @@ impl<T: TimeProvider> AuthCodes<T> {
|
||||
pub fn new(codes: Vec<String>, now: T) -> Self {
|
||||
AuthCodes {
|
||||
codes: codes.into_iter().map(|code| Code {
|
||||
code: code,
|
||||
code,
|
||||
created_at: time::Duration::from_secs(now.now()),
|
||||
last_used_at: None,
|
||||
}).collect(),
|
||||
now: now,
|
||||
now,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ impl<T: TimeProvider> AuthCodes<T> {
|
||||
.join("-");
|
||||
trace!(target: "signer", "New authentication token generated.");
|
||||
self.codes.push(Code {
|
||||
code: code,
|
||||
code,
|
||||
created_at: time::Duration::from_secs(self.now.now()),
|
||||
last_used_at: None,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user