Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
uros-5 committed May 13, 2024
1 parent 8d17914 commit adeb561
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion jinja-lsp-queries/src/search/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl JinjaDefinitions {
let current_scope = self.current_scope.front().unwrap_or(&Scope::default()).id;
identifier.start = start;
identifier.end = end;
identifier.name = content.to_owned();
content.to_owned().clone_into(&mut identifier.name);
identifier.scope_ends.0 = current_scope;
let last = self.definitions.last_mut();
if let Some(last) = last {
Expand Down
12 changes: 7 additions & 5 deletions jinja-lsp-queries/src/tree_builder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Display;

use tower_lsp::lsp_types::DiagnosticSeverity;

#[derive(PartialEq, Eq, Debug, Copy, Clone, Hash)]
Expand All @@ -23,12 +25,12 @@ impl JinjaDiagnostic {
}
}

impl ToString for JinjaDiagnostic {
fn to_string(&self) -> String {
impl Display for JinjaDiagnostic {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
JinjaDiagnostic::Undefined => String::from("Undefined variable"),
JinjaDiagnostic::DefinedSomewhere => String::from("Variable is defined in other file."),
JinjaDiagnostic::TemplateNotFound => String::from("Template not found"),
JinjaDiagnostic::Undefined => f.write_str("Undefined variable"),
JinjaDiagnostic::DefinedSomewhere => f.write_str("Variable is defined in other file."),
JinjaDiagnostic::TemplateNotFound => f.write_str("Template not found"),
}
}
}
4 changes: 2 additions & 2 deletions jinja-lsp/src/lsp_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl LspFiles {
let query = &self.queries.jinja_objects;
let objects = objects_query(query, tree, point, &writter.content, false);
let mut res = objects.is_ident(point).and_then(|ident| {
current_ident = ident.to_owned();
ident.clone_into(&mut current_ident);
let variables = self.variables.get(&uri)?;
let max = variables
.iter()
Expand Down Expand Up @@ -676,7 +676,7 @@ impl LspFiles {
}

pub fn data_type(&self, uri: Url, hover: Identifier) -> Option<IdentifierType> {
let this_file = self.variables.get(&uri.as_str().to_string())?;
let this_file = self.variables.get(uri.as_str())?;
let this_file = this_file
.iter()
.filter(|variable| variable.identifier_type != IdentifierType::TemplateBlock)
Expand Down

0 comments on commit adeb561

Please sign in to comment.