diff options
author | Valentin Anger <syrupthinker@gryphno.de> | 2020-06-29 14:17:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 14:17:37 +0200 |
commit | db36857288609858ada259444509a31637980ce3 (patch) | |
tree | 9fc83f32408941bdf75d803b4b0dbffe297c10f2 /cli/lint.rs | |
parent | 0374eadcf7ecb054dae1b1587843a2006fdf4c2d (diff) |
refactor: util functions take slices instead of heap values (#6547)
Diffstat (limited to 'cli/lint.rs')
-rw-r--r-- | cli/lint.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cli/lint.rs b/cli/lint.rs index 901e678ce..956a638c8 100644 --- a/cli/lint.rs +++ b/cli/lint.rs @@ -102,20 +102,17 @@ fn lint_file(file_path: PathBuf) -> Result<Vec<LintDiagnostic>, ErrBox> { } fn format_diagnostic(d: &LintDiagnostic) -> String { - let pretty_message = format!( - "({}) {}", - colors::gray(d.code.to_string()), - d.message.clone() - ); + let pretty_message = + format!("({}) {}", colors::gray(&d.code), d.message.clone()); fmt_errors::format_stack( true, - pretty_message, - Some(d.line_src.clone()), + &pretty_message, + Some(&d.line_src), Some(d.location.col as i64), Some((d.location.col + d.snippet_length) as i64), &[fmt_errors::format_location( - d.location.filename.clone(), + &d.location.filename, d.location.line as i64, d.location.col as i64, )], |