signatures: Remove needless pre-declarations

This commit is contained in:
Jonas Platte 2021-03-21 20:26:24 +01:00
parent f196f5b6f1
commit c96537c7d6
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -138,17 +138,14 @@ pub fn sign_json<K>(
where
K: KeyPair,
{
let mut signature_map;
let maybe_unsigned;
// FIXME: Once MSRV >= 1.45.0, use remove_key and don't allocate new `String`s below.
signature_map = match object.remove("signatures") {
let mut signature_map = match object.remove("signatures") {
Some(CanonicalJsonValue::Object(signatures)) => signatures,
Some(_) => return Err(Error::new("field `signatures` must be a JSON object")),
None => BTreeMap::new(),
};
maybe_unsigned = object.remove("unsigned");
let maybe_unsigned = object.remove("unsigned");
// Get the canonical JSON string.
let json = to_canonical_json_string(object)?;