summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Otto <th1000s@posteo.net>2023-06-07 22:51:17 +0200
committerDan Davison <dandavison7@gmail.com>2024-08-01 21:40:55 -0400
commit546e0ed412e1cdfc08d623b692604a228c538073 (patch)
treeb235d5129541e3bc9227d69c54b59f350a97d74b /src
parentc5f7428eddd07787602a1111180798d5b955c306 (diff)
Make drop impl of OutputType more prominent
Diffstat (limited to 'src')
-rw-r--r--src/utils/bat/output.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/utils/bat/output.rs b/src/utils/bat/output.rs
index e93fe2c..c3f4a04 100644
--- a/src/utils/bat/output.rs
+++ b/src/utils/bat/output.rs
@@ -51,6 +51,14 @@ pub enum OutputType {
Stdout(io::Stdout),
}
+impl Drop for OutputType {
+ fn drop(&mut self) {
+ if let OutputType::Pager(ref mut command) = *self {
+ let _ = command.wait();
+ }
+ }
+}
+
impl OutputType {
/// Create a pager and write all data into it. Waits until the pager exits.
/// The expectation is that the program will exit afterwards.
@@ -241,11 +249,3 @@ delta is not an appropriate value for $PAGER \
None
}
}
-
-impl Drop for OutputType {
- fn drop(&mut self) {
- if let OutputType::Pager(ref mut command) = *self {
- let _ = command.wait();
- }
- }
-}