diff options
| author | acdenisSK <[email protected]> | 2017-09-17 13:11:43 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-09-17 13:12:10 +0200 |
| commit | 86e30297b9b28d4dca4918d46570ff71be8db591 (patch) | |
| tree | cd95798c80da99c802c0322777ffe51bb0b9c9a5 /src | |
| parent | Apply rustfmt (diff) | |
| download | serenity-86e30297b9b28d4dca4918d46570ff71be8db591.tar.xz serenity-86e30297b9b28d4dca4918d46570ff71be8db591.zip | |
if let -> and_then/map
Diffstat (limited to 'src')
| -rw-r--r-- | src/model/channel/attachment.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/model/channel/attachment.rs b/src/model/channel/attachment.rs index 5d47469..af15bf7 100644 --- a/src/model/channel/attachment.rs +++ b/src/model/channel/attachment.rs @@ -32,11 +32,7 @@ impl Attachment { /// If this attachment is an image, then a tuple of the width and height /// in pixels is returned. pub fn dimensions(&self) -> Option<(u64, u64)> { - if let (Some(width), Some(height)) = (self.width, self.height) { - Some((width, height)) - } else { - None - } + self.width.and_then(|width| self.height.map(|height| (width, height))) } /// Downloads the attachment, returning back a vector of bytes. |