Skip to content

tee: use is_ok at fn write_flush#11950

Closed
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:tee-simple
Closed

tee: use is_ok at fn write_flush#11950
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:tee-simple

Conversation

@oech3
Copy link
Copy Markdown
Contributor

@oech3 oech3 commented Apr 23, 2026

match is difficult to understand

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 23, 2026

Merging this PR will degrade performance by 23.82%

❌ 1 regressed benchmark
✅ 308 untouched benchmarks
⏩ 46 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory cp_recursive_deep_tree[(120, 4)] 532.7 KB 699.2 KB -23.82%

Comparing oech3:tee-simple (d0c42e7) with main (fe7e262)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@oech3 oech3 marked this pull request as ready for review April 23, 2026 01:32
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/misc/io-errors. tests/misc/io-errors is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/tail/pid-pipe is no longer failing!
Note: The gnu test tests/printf/printf-surprise is now being skipped but was previously passing.

@xtqqczze
Copy link
Copy Markdown
Contributor

match is difficult to understand

On the contrary, map_err(...).is_ok() is non-idiomatic use of combinators; the match has clear control flow.

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented Apr 23, 2026 via email

Comment thread src/uu/tee/src/tee.rs
Comment on lines +204 to +209
res.map_err(|e| {
if let Err(e) = process_error(mode, e, writer, &mut self.ignored_errors) {
aborted.get_or_insert(e);
}
}
})
.is_ok()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
res.map_err(|e| {
if let Err(e) = process_error(mode, e, writer, &mut self.ignored_errors) {
aborted.get_or_insert(e);
}
}
})
.is_ok()
if let Err(e) = res {
if let Err(e) = process_error(mode, e, writer, &mut self.ignored_errors) {
aborted.get_or_insert(e);
}
false
} else {
true
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It manually returns true and false instead of reusing bool.

@oech3 oech3 marked this pull request as draft April 23, 2026 06:57
@oech3 oech3 closed this Apr 23, 2026
@oech3 oech3 deleted the tee-simple branch April 23, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants