From 85cfab998987e65da553af45099b8f334308f760 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 24 Jan 2024 17:45:10 +0530 Subject: [PATCH] refactor(error): fix warnings by 'cargo clippy' for error Signed-off-by: Abhishek Kumar --- kclvm/error/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kclvm/error/src/lib.rs b/kclvm/error/src/lib.rs index e1011786c..5af39db81 100644 --- a/kclvm/error/src/lib.rs +++ b/kclvm/error/src/lib.rs @@ -262,7 +262,7 @@ impl From for Diagnostic { }; Diagnostic::new_with_code( Level::Error, - &panic_msg, + panic_msg, None, (pos.clone(), pos), None, @@ -280,7 +280,7 @@ impl From for Diagnostic { if frame.col != 0 { backtrace_msg.push_str(&format!(":{}", frame.col)) } - backtrace_msg.push_str("\n") + backtrace_msg.push('\n') } let pos = Position { filename: panic_info.kcl_file.clone(), @@ -289,7 +289,7 @@ impl From for Diagnostic { }; Diagnostic::new_with_code( Level::Error, - &panic_msg, + panic_msg, Some(&backtrace_msg), (pos.clone(), pos), None, @@ -429,7 +429,7 @@ impl SessionDiagnostic for Diagnostic { diag.append_component(Box::new(format!(": {}\n", warning.name()))); } DiagnosticId::Suggestions => { - diag.append_component(Box::new(SuggestionsLabel::default())); + diag.append_component(Box::new(SuggestionsLabel)); } }, None => match self.level { @@ -443,7 +443,7 @@ impl SessionDiagnostic for Diagnostic { diag.append_component(Box::new(Label::Note)); } Level::Suggestions => { - diag.append_component(Box::new(SuggestionsLabel::default())); + diag.append_component(Box::new(SuggestionsLabel)); } }, }