mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(native): needless borrows for generic args (#6039)
This commit is contained in:
@@ -45,7 +45,7 @@ impl Stamp {
|
|||||||
|
|
||||||
// check challenge
|
// check challenge
|
||||||
let mut hasher = Sha3_256::new();
|
let mut hasher = Sha3_256::new();
|
||||||
hasher.update(&self.format().as_bytes());
|
hasher.update(self.format().as_bytes());
|
||||||
let result = format!("{:x}", hasher.finalize());
|
let result = format!("{:x}", hasher.finalize());
|
||||||
result[..hex_digits] == String::from_utf8(vec![b'0'; hex_digits]).unwrap()
|
result[..hex_digits] == String::from_utf8(vec![b'0'; hex_digits]).unwrap()
|
||||||
} else {
|
} else {
|
||||||
@@ -87,7 +87,7 @@ impl Stamp {
|
|||||||
let hex_digits = ((bits as f32) / 4.).ceil() as usize;
|
let hex_digits = ((bits as f32) / 4.).ceil() as usize;
|
||||||
let zeros = String::from_utf8(vec![b'0'; hex_digits]).unwrap();
|
let zeros = String::from_utf8(vec![b'0'; hex_digits]).unwrap();
|
||||||
loop {
|
loop {
|
||||||
hasher.update(&format!("{}:{:x}", challenge, counter).as_bytes());
|
hasher.update(format!("{}:{:x}", challenge, counter).as_bytes());
|
||||||
let result = format!("{:x}", hasher.finalize_reset());
|
let result = format!("{:x}", hasher.finalize_reset());
|
||||||
if result[..hex_digits] == zeros {
|
if result[..hex_digits] == zeros {
|
||||||
break format!("{:x}", counter);
|
break format!("{:x}", counter);
|
||||||
|
|||||||
Reference in New Issue
Block a user