mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-06 18:30:35 +00:00
add pedantic clippy setting and fix/allow warnings (#147)
Some checks are pending
lint / pre-commit (push) Waiting to run
lint / rustfmt (push) Waiting to run
lint / clippy (push) Waiting to run
lint / cargo-check (push) Waiting to run
release / build (push) Waiting to run
release / test (push) Waiting to run
release / release (push) Blocked by required conditions
test / generate-matrix (push) Waiting to run
test / Python , Django () (push) Blocked by required conditions
test / tests (push) Blocked by required conditions
zizmor 🌈 / zizmor latest via PyPI (push) Waiting to run
Some checks are pending
lint / pre-commit (push) Waiting to run
lint / rustfmt (push) Waiting to run
lint / clippy (push) Waiting to run
lint / cargo-check (push) Waiting to run
release / build (push) Waiting to run
release / test (push) Waiting to run
release / release (push) Blocked by required conditions
test / generate-matrix (push) Waiting to run
test / Python , Django () (push) Blocked by required conditions
test / tests (push) Blocked by required conditions
zizmor 🌈 / zizmor latest via PyPI (push) Waiting to run
This commit is contained in:
parent
e87c917cb6
commit
d677aacf7c
24 changed files with 180 additions and 113 deletions
|
@ -19,3 +19,6 @@ djls-dev = { workspace = true }
|
|||
|
||||
[dev-dependencies]
|
||||
tempfile = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -23,6 +23,7 @@ pub struct DjangoProject {
|
|||
}
|
||||
|
||||
impl DjangoProject {
|
||||
#[must_use]
|
||||
pub fn new(path: PathBuf) -> Self {
|
||||
Self {
|
||||
path,
|
||||
|
@ -64,17 +65,19 @@ impl DjangoProject {
|
|||
Ok(())
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to import Django: {}", e);
|
||||
eprintln!("Failed to import Django: {e}");
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn template_tags(&self) -> Option<&TemplateTags> {
|
||||
self.template_tags.as_ref()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn path(&self) -> &Path {
|
||||
&self.path
|
||||
}
|
||||
|
@ -84,7 +87,7 @@ impl fmt::Display for DjangoProject {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
writeln!(f, "Project path: {}", self.path.display())?;
|
||||
if let Some(py_env) = &self.env {
|
||||
write!(f, "{}", py_env)?;
|
||||
write!(f, "{py_env}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -141,7 +144,7 @@ mod tests {
|
|||
|
||||
let project = DjangoProject::new(project_path.clone());
|
||||
|
||||
let display_str = format!("{}", project);
|
||||
let display_str = format!("{project}");
|
||||
assert!(display_str.contains(&format!("Project path: {}", project_path.display())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,9 +96,8 @@ impl PythonEnvironment {
|
|||
}
|
||||
|
||||
fn from_system_python() -> Option<Self> {
|
||||
let python_path = match system::find_executable("python") {
|
||||
Ok(p) => p,
|
||||
Err(_) => return None,
|
||||
let Ok(python_path) = system::find_executable("python") else {
|
||||
return None;
|
||||
};
|
||||
let bin_dir = python_path.parent()?;
|
||||
let prefix = bin_dir.parent()?;
|
||||
|
|
|
@ -35,7 +35,7 @@ impl TemplateTags {
|
|||
let library_name = if module_name.is_empty() {
|
||||
"builtins".to_string()
|
||||
} else {
|
||||
module_name.split('.').last().unwrap_or("").to_string()
|
||||
module_name.split('.').next_back().unwrap_or("").to_string()
|
||||
};
|
||||
|
||||
tags.push(TemplateTag::new(tag_name, library_name, doc));
|
||||
|
@ -90,7 +90,7 @@ impl TemplateTag {
|
|||
&self.library
|
||||
}
|
||||
|
||||
pub fn doc(&self) -> &Option<String> {
|
||||
&self.doc
|
||||
pub fn doc(&self) -> Option<&String> {
|
||||
self.doc.as_ref()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue