Skip to content

Commit fbfa7b3

Browse files
authored
Remove need for let _ with global timer (#38)
Before: ``` let timer = print::sub_start_timer("Installing"); // ... let _ = timer.done(); ``` After: ``` let timer = print::sub_start_timer("Installing"); // ... timer.done(); ``` This change removes the "must use" attribute from the return value of the stateful interface. The downside is that anyone using the stateful interface can call `.done()` here without doing anything else with the value. But that would also mean that nothing else in their code uses the value, so it's likely they didn't need it anyway. I'm now advocating for the global "print" interface over the stateful interface. Close #37
1 parent ce8fd41 commit fbfa7b3

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Change: Result of `global::sub_start_timer(...).done()` is no longer "must use". This means it no longer needs `let _ =` for clippy. (https://github.com/heroku-buildpacks/bullet_stream/pull/38)
6+
57
## v0.8.0 - 2024/04/24
68

79
- Add: explicit `print::buildpack` and `print::header` functions that are focused on intent rather than implementation detail (https://github.com/heroku-buildpacks/bullet_stream/pull/34)

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ where
432432
///
433433
/// Once you're finished with your long running task, calling this function
434434
/// finalizes the timer's output and transitions back to a [`state::SubBullet`].
435-
#[must_use]
436435
pub fn done(self) -> Print<state::SubBullet<W>> {
437436
let duration = self.state.started.elapsed();
438437
let mut io = match self.state.write.stop() {

src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ where
116116
style::running_command(command.name()),
117117
);
118118
let output = command.named_output();
119-
let _ = timer.done();
119+
timer.done();
120120
output
121121
}
122122

0 commit comments

Comments
 (0)