From 40dc584f943ccb5b0dde05c5d7877bacb60d00b6 Mon Sep 17 00:00:00 2001 From: meh Date: Sat, 20 Mar 2021 19:35:40 +0100 Subject: [PATCH] style: run cargo fmt --- src/format/context/destructor.rs | 8 +++++++- src/format/format/input.rs | 4 ++-- src/format/format/output.rs | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/format/context/destructor.rs b/src/format/context/destructor.rs index 42b41c3..e5c67fc 100644 --- a/src/format/context/destructor.rs +++ b/src/format/context/destructor.rs @@ -23,7 +23,13 @@ impl Drop for Destructor { match self.mode { Mode::Input => avformat_close_input(&mut self.ptr), Mode::Output => { - if (*self.ptr).flags & AVFMT_NOFILE != 0 && !(*(*self.ptr).pb).av_class.is_null() { + if (*self.ptr).flags & AVFMT_NOFILE != 0 + && (*self.ptr) + .pb + .as_ref() + .map(|pb| !(*pb).av_class.is_null()) + .unwrap_or(false) + { avio_close((*self.ptr).pb); } diff --git a/src/format/format/input.rs b/src/format/format/input.rs index 318b2ec..836ff78 100644 --- a/src/format/format/input.rs +++ b/src/format/format/input.rs @@ -7,8 +7,8 @@ pub struct Input { ptr: *mut AVInputFormat, } -unsafe impl Send for Input { } -unsafe impl Sync for Input { } +unsafe impl Send for Input {} +unsafe impl Sync for Input {} impl Input { pub unsafe fn wrap(ptr: *mut AVInputFormat) -> Self { diff --git a/src/format/format/output.rs b/src/format/format/output.rs index 56e3fda..2ff177e 100644 --- a/src/format/format/output.rs +++ b/src/format/format/output.rs @@ -13,8 +13,8 @@ pub struct Output { ptr: *mut AVOutputFormat, } -unsafe impl Send for Output { } -unsafe impl Sync for Output { } +unsafe impl Send for Output {} +unsafe impl Sync for Output {} impl Output { pub unsafe fn wrap(ptr: *mut AVOutputFormat) -> Self {