mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
DcKey::to_base64 can not fail
As this can't fail, we don't have to expose Result on this and can keep the API simpler.
This commit is contained in:
committed by
Floris Bruynooghe
parent
c41bdaa2b7
commit
4d0a08d858
@@ -106,19 +106,16 @@ impl fmt::Display for Aheader {
|
||||
// adds a whitespace every 78 characters, this allows
|
||||
// email crate to wrap the lines according to RFC 5322
|
||||
// (which may insert a linebreak before every whitespace)
|
||||
let keydata = self
|
||||
.public_key
|
||||
.to_base64()
|
||||
.unwrap_or_default()
|
||||
.chars()
|
||||
.enumerate()
|
||||
.fold(String::new(), |mut res, (i, c)| {
|
||||
let keydata = self.public_key.to_base64().chars().enumerate().fold(
|
||||
String::new(),
|
||||
|mut res, (i, c)| {
|
||||
if i % 78 == 78 - "keydata=".len() {
|
||||
res.push(' ')
|
||||
}
|
||||
res.push(c);
|
||||
res
|
||||
});
|
||||
},
|
||||
);
|
||||
write!(fmt, " keydata={}", keydata)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user