Skip to content

Commit a460615

Browse files
committed
Ruby: address review comment
1 parent fa81d9d commit a460615

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

ruby/extractor/src/diagnostics.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ impl LogWriter {
119119
None => tracing::debug!("{}", full_error_message),
120120
}
121121
if self.inner.is_none() {
122-
let mut open_failed = false;
123-
self.inner = self.path.as_ref().and_then(|path| {
122+
if let Some(path) = self.path.as_ref() {
124123
match std::fs::OpenOptions::new()
125124
.create(true)
126125
.append(true)
@@ -133,14 +132,11 @@ impl LogWriter {
133132
&path.to_string_lossy(),
134133
e
135134
);
136-
open_failed = true;
137-
None
135+
self.path = None;
136+
self.inner = None
138137
}
139-
Ok(file) => Some(std::io::BufWriter::new(file)),
138+
Ok(file) => self.inner = Some(std::io::BufWriter::new(file)),
140139
}
141-
});
142-
if open_failed {
143-
self.path = None
144140
}
145141
}
146142
if let Some(mut writer) = self.inner.as_mut() {

0 commit comments

Comments
 (0)