1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-11-23 21:54:45 +02:00

printer: slightly simplify code

I'm not sure why it was written with `map` previously. It almost looks
like I was trying to make it deref, but apparently that isn't needed.

Closes #2941
This commit is contained in:
ChristopherYoung
2024-11-29 16:44:28 +08:00
committed by Andrew Gallant
parent 75e17fcabe
commit 5e2d32fe7f

View File

@@ -762,10 +762,8 @@ impl<'p, 's, M: Matcher, W: WriteColor> StandardSink<'p, 's, M, W> {
) -> io::Result<()> {
self.replacer.clear();
if self.standard.config.replacement.is_some() {
let replacement = (*self.standard.config.replacement)
.as_ref()
.map(|r| &*r)
.unwrap();
let replacement =
(*self.standard.config.replacement).as_ref().unwrap();
self.replacer.replace_all(
searcher,
&self.matcher,