Repository navigation
Implement -fprintf - #444
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #444 +/- ##
==========================================
+ Coverage 66.53% 66.57% +0.03%
==========================================
Files 36 36
Lines 4378 4404 +26
Branches 986 993 +7
==========================================
+ Hits 2913 2932 +19
- Misses 1063 1064 +1
- Partials 402 408 +6 ☔ View full report in Codecov by Sentry. |
|
Commit b5853cb has GNU testsuite comparison: |
|
needs rebasing |
|
Commit dc33ca5 has GNU testsuite comparison: |
|
Commit 67eb6f5 has GNU testsuite comparison: |
|
Commit 4ed3bc0 has GNU testsuite comparison: |
|
Commit 07e9b11 has GNU testsuite comparison: |
|
Commit 4130c38 has GNU testsuite comparison: |
|
Any idea why |
|
Commit 6f64a19 has GNU testsuite comparison: |
I guess it's something to do with the total number of GNU tests changing? But at least we know the code works. |
| if let Some(file) = &self.output_file { | ||
| self.print(file_info, file); | ||
| } else { | ||
| self.print(file_info, &mut *matcher_io.deps.get_output().borrow_mut()); | ||
| } |
There was a problem hiding this comment.
a bit more rust idiomatic:
| if let Some(file) = &self.output_file { | |
| self.print(file_info, file); | |
| } else { | |
| self.print(file_info, &mut *matcher_io.deps.get_output().borrow_mut()); | |
| } | |
| let output = self.output_file.as_ref() | |
| .unwrap_or_else(|| matcher_io.deps.get_output().borrow_mut()); | |
| self.print(file_info, output); |
There was a problem hiding this comment.
Wow, that's much cleaner.
I tried modifying it but I seem to be having some type issues.
error[E0308]: mismatched types
--> src/find/matchers/printf.rs:628:32
|
628 | .unwrap_or_else(|| matcher_io.deps.get_output().borrow_mut());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
expected `&File`, found `RefMut<'_, dyn Write>`
|
= note: expected reference `&File`
found struct `RefMut<'_, (dyn std::io::Write + 'static)>`
and I also tried:
fn print(&self, file_info: &WalkEntry, out: &mut dyn Write) { ... }
...
let output: &mut dyn Write = self.output_file
.as_ref()
.map(|file| file.borrow_mut() as &mut dyn Write)
.unwrap_or_else(|| matcher_io.deps.get_output().borrow_mut());
self.print(file_info, output);
...
I'm relatively new at this, would you mind pointing me out further?
|
this version is good enough, thanks :) |
Closes #383