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

This commit is contained in:
Josh Thomas 2025-05-14 18:21:43 -05:00 committed by GitHub
parent e87c917cb6
commit d677aacf7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 180 additions and 113 deletions

View file

@ -1,3 +1,5 @@
use std::fmt::Write;
use anyhow::Result;
use clap::Parser;
@ -33,7 +35,7 @@ pub fn run(args: Vec<String>) -> Result<()> {
Err(e) => {
let mut msg = e.to_string();
if let Some(source) = e.source() {
msg += &format!(", caused by {}", source);
let _ = write!(msg, ", caused by {source}");
}
Exit::error().with_message(msg).process_exit()
}

View file

@ -36,7 +36,7 @@ impl From<ExitStatus> for i32 {
impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = self.as_str();
write!(f, "{}", msg)
write!(f, "{msg}")
}
}
@ -69,7 +69,7 @@ impl Exit {
pub fn process_exit(self) -> ! {
if let Some(message) = self.message {
println!("{}", message)
println!("{message}");
}
std::process::exit(self.status.as_raw())
}
@ -78,7 +78,7 @@ impl Exit {
pub fn ok(self) -> Result<()> {
match self.status {
ExitStatus::Success => Ok(()),
_ => Err(self.into()),
ExitStatus::Error => Err(self.into()),
}
}
@ -92,8 +92,8 @@ impl fmt::Display for Exit {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let status_str = self.status.as_str();
match &self.message {
Some(msg) => write!(f, "{}: {}", status_str, msg),
None => write!(f, "{}", status_str),
Some(msg) => write!(f, "{status_str}: {msg}"),
None => write!(f, "{status_str}"),
}
}
}

View file

@ -1,7 +1,7 @@
/// PyO3 entrypoint for the Django Language Server CLI.
/// `PyO3` entrypoint for the Django Language Server CLI.
///
/// This module provides a Python interface using PyO3 to solve Python runtime
/// interpreter linking issues. The PyO3 approach avoids complexities with
/// This module provides a Python interface using `PyO3` to solve Python runtime
/// interpreter linking issues. The `PyO3` approach avoids complexities with
/// static/dynamic linking when building binaries that interact with Python.
mod args;
mod cli;

View file

@ -1,7 +1,7 @@
/// Binary interface for local development only.
///
/// This binary exists for development and testing with `cargo run`.
/// The production CLI is distributed through the PyO3 interface in lib.rs.
/// The production CLI is distributed through the `PyO3` interface in lib.rs.
mod args;
mod cli;
mod commands;