Reduce turbofish usage

Should make the code a little bit easier to read.
This commit is contained in:
Jonas Platte 2021-10-13 11:51:30 +02:00
parent 1c4d9af586
commit f2ef5677e0
No known key found for this signature in database
GPG key ID: CC154DE0E30B7C67
23 changed files with 331 additions and 387 deletions

View file

@ -69,8 +69,8 @@ impl PduEvent {
_ => &[],
};
let mut old_content =
serde_json::from_str::<BTreeMap<String, serde_json::Value>>(self.content.get())
let mut old_content: BTreeMap<String, serde_json::Value> =
serde_json::from_str(self.content.get())
.map_err(|_| Error::bad_database("PDU in db has invalid content."))?;
let mut new_content = serde_json::Map::new();
@ -92,8 +92,8 @@ impl PduEvent {
pub fn remove_transaction_id(&mut self) -> crate::Result<()> {
if let Some(unsigned) = &self.unsigned {
let mut unsigned =
serde_json::from_str::<BTreeMap<String, Box<RawJsonValue>>>(unsigned.get())
let mut unsigned: BTreeMap<String, Box<RawJsonValue>> =
serde_json::from_str(unsigned.get())
.map_err(|_| Error::bad_database("Invalid unsigned in pdu event"))?;
unsigned.remove("transaction_id");
self.unsigned = Some(to_raw_value(&unsigned).expect("unsigned is valid"));