Skip to content

Commit 82d38a8

Browse files
committed
Simplify Completion::with_status implementation
1 parent 0037af7 commit 82d38a8

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/error/completion.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,10 @@ impl<T> Completion<T> {
6565
/// be stored, one of them will be spilled into the logs.
6666
///
6767
pub fn with_status(self, extra_status: Status) -> Self {
68-
match self {
69-
Completion::Success(res) => {
70-
if extra_status.is_success() {
71-
Completion::Success(res)
72-
} else {
73-
Completion::Warning(res, extra_status)
74-
}
75-
}
76-
Completion::Warning(res, stat) => {
77-
if extra_status.is_success() {
78-
Completion::Warning(res, stat)
79-
} else {
80-
log_warning(stat);
81-
Completion::Warning(res, extra_status)
82-
}
83-
}
68+
if extra_status.is_success() {
69+
self
70+
} else {
71+
Completion::Warning(self.log(), extra_status)
8472
}
8573
}
8674
}

0 commit comments

Comments
 (0)