Resolve TODO

This commit is contained in:
Jonas Platte 2020-08-18 00:03:24 +02:00
parent 679f824c67
commit 3428cabdca
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -47,10 +47,7 @@ where
T: serde::Deserialize<'de>, T: serde::Deserialize<'de>,
{ {
let opt = Option::<String>::deserialize(de)?; let opt = Option::<String>::deserialize(de)?;
// TODO: Switch to and remove this attribute `opt.as_deref()` once MSRV is >= 1.40 match opt.as_deref() {
#[allow(clippy::option_as_ref_deref, clippy::unknown_clippy_lints)]
let opt = opt.as_ref().map(String::as_str);
match opt {
None | Some("") => Ok(None), None | Some("") => Ok(None),
// If T = String, like in m.room.name, the second deserialize is actually superfluous. // If T = String, like in m.room.name, the second deserialize is actually superfluous.
// TODO: optimize that somehow? // TODO: optimize that somehow?