Skip to content

Commit fa81d9d

Browse files
aibaarshmac
andauthored
Apply suggestions from code review
Co-authored-by: Harry Maclean <[email protected]>
1 parent 5701271 commit fa81d9d

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

ruby/extractor/src/diagnostics.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,52 +215,52 @@ impl DiagnosticMessage {
215215
}
216216
}
217217

218-
pub fn text<'a>(&'a mut self, text: &str) -> &'a mut Self {
218+
pub fn text(&mut self, text: &str) -> &mut Self {
219219
self.plaintext_message = text.to_owned();
220220
self
221221
}
222222

223223
#[allow(unused)]
224-
pub fn markdown<'a>(&'a mut self, text: &str) -> &'a mut Self {
224+
pub fn markdown(&mut self, text: &str) -> &mut Self {
225225
self.markdown_message = text.to_owned();
226226
self
227227
}
228-
pub fn severity<'a>(&'a mut self, severity: Severity) -> &'a mut Self {
228+
pub fn severity(&mut self, severity: Severity) -> &mut Self {
229229
self.severity = Some(severity);
230230
self
231231
}
232232
#[allow(unused)]
233-
pub fn help_link<'a>(&'a mut self, link: &str) -> &'a mut Self {
233+
pub fn help_link(&mut self, link: &str) -> &mut Self {
234234
self.help_links.push(link.to_owned());
235235
self
236236
}
237237
#[allow(unused)]
238-
pub fn internal<'a>(&'a mut self) -> &'a mut Self {
238+
pub fn internal(&mut self) -> &mut Self {
239239
self.internal = true;
240240
self
241241
}
242242
#[allow(unused)]
243-
pub fn cli_summary_table<'a>(&'a mut self) -> &'a mut Self {
243+
pub fn cli_summary_table(&mut self) -> &mut Self {
244244
self.visibility.cli_summary_table = true;
245245
self
246246
}
247-
pub fn status_page<'a>(&'a mut self) -> &'a mut Self {
247+
pub fn status_page(&mut self) -> &mut Self {
248248
self.visibility.status_page = true;
249249
self
250250
}
251251
#[allow(unused)]
252-
pub fn telemetry<'a>(&'a mut self) -> &'a mut Self {
252+
pub fn telemetry(&mut self) -> &mut Self {
253253
self.visibility.telemetry = true;
254254
self
255255
}
256-
pub fn location<'a>(
257-
&'a mut self,
256+
pub fn location(
257+
&mut self,
258258
path: &str,
259259
start_line: usize,
260260
start_column: usize,
261261
end_line: usize,
262262
end_column: usize,
263-
) -> &'a mut Self {
263+
) -> &mut Self {
264264
let loc = self.location.get_or_insert(Default::default());
265265
loc.file = Some(path.to_owned());
266266
loc.start_line = Some(start_line);

ruby/extractor/src/extractor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ fn location_for(visitor: &mut Visitor, n: Node) -> (usize, usize, usize, usize)
588588
if index > 0 && index <= source.len() {
589589
index -= 1;
590590
if source[index] != b'\n' {
591-
&visitor.diagnostics_writer.write(
592-
&visitor
591+
visitor.diagnostics_writer.write(
592+
visitor
593593
.diagnostics_writer
594594
.message("internal-error", "Internal error")
595595
.text("expecting a line break symbol, but none found while correcting end column value")
@@ -604,8 +604,8 @@ fn location_for(visitor: &mut Visitor, n: Node) -> (usize, usize, usize, usize)
604604
end_col += 1;
605605
}
606606
} else {
607-
&visitor.diagnostics_writer.write(
608-
&visitor
607+
visitor.diagnostics_writer.write(
608+
visitor
609609
.diagnostics_writer
610610
.message("internal-error", "Internal error")
611611
.text(&format!(

ruby/extractor/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ fn main() -> std::io::Result<()> {
6767
)
6868
.init();
6969
let diagnostics = diagnostics::DiagnosticLoggers::new("ruby");
70-
let main_thread_logger = &mut diagnostics.logger();
70+
let mut main_thread_logger = diagnostics.logger();
7171
let num_threads = match num_codeql_threads() {
7272
Ok(num) => num,
7373
Err(e) => {
7474
main_thread_logger.write(
75-
&main_thread_logger
75+
main_thread_logger
7676
.message("configuration-error", "Configuration error")
7777
.text(&format!("{}; defaulting to 1 thread.", e))
7878
.status_page()
@@ -94,7 +94,7 @@ fn main() -> std::io::Result<()> {
9494
Ok(x) => x,
9595
Err(e) => {
9696
main_thread_logger.write(
97-
&main_thread_logger
97+
main_thread_logger
9898
.message("configuration-error", "Configuration error")
9999
.text(&format!("{}; using gzip.", e))
100100
.status_page()
@@ -198,7 +198,7 @@ fn main() -> std::io::Result<()> {
198198
Err(msg) => {
199199
needs_conversion = false;
200200
diagnostics_writer.write(
201-
&diagnostics_writer
201+
diagnostics_writer
202202
.message(
203203
"character-encoding-error",
204204
"Character encoding error",
@@ -217,7 +217,7 @@ fn main() -> std::io::Result<()> {
217217
}
218218
} else {
219219
diagnostics_writer.write(
220-
&diagnostics_writer
220+
diagnostics_writer
221221
.message("character-encoding-error", "Character encoding error")
222222
.text(&format!(
223223
"{}: unknown character encoding: '{}'",

0 commit comments

Comments
 (0)