diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-28 10:48:00 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@sequoia-pgp.org> | 2021-09-30 08:31:14 +0300 |
commit | f7d55f1f915065d6b886e21c4efb7452cfa10e1c (patch) | |
tree | 298ff23dc07982464ab57ad2f5bda8c02af739aa | |
parent | 48b1bb5324a63bb4688a4cba206cb39b83ce1783 (diff) |
Use as_deref
Instead of this:
foo.as_ref().map(|x| x.as_slice())
do this:
foo.as_deref()
It's shorter and more to the point, and should thus be easier to
understand.
Found by clippy lint option_as_ref_deref:
https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref
-rw-r--r-- | openpgp/src/packet/literal.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/openpgp/src/packet/literal.rs b/openpgp/src/packet/literal.rs index 29bfa187..14b98b38 100644 --- a/openpgp/src/packet/literal.rs +++ b/openpgp/src/packet/literal.rs @@ -110,7 +110,7 @@ impl Literal { /// only the literal data packet's body is protected, not the /// meta-data. As such, this field should normally be ignored. pub fn filename(&self) -> Option<&[u8]> { - self.filename.as_ref().map(|b| b.as_slice()) + self.filename.as_deref() } /// Sets the literal packet's filename field. |