mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-07 13:15:06 +00:00
Use #[expect(lint)]
over #[allow(lint)]
where possible (#17822)
This commit is contained in:
parent
8535af8516
commit
fa628018b2
148 changed files with 221 additions and 268 deletions
|
@ -13,7 +13,6 @@ fn main() {
|
|||
|
||||
commit_info(&workspace_root);
|
||||
|
||||
#[allow(clippy::disallowed_methods)]
|
||||
let target = std::env::var("TARGET").unwrap();
|
||||
println!("cargo::rustc-env=RUST_HOST_TARGET={target}");
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ pub struct Args {
|
|||
pub(crate) global_options: GlobalConfigArgs,
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[expect(clippy::large_enum_variant)]
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub enum Command {
|
||||
/// Run Ruff on the given files or directories.
|
||||
|
@ -184,7 +184,7 @@ pub struct AnalyzeGraphCommand {
|
|||
|
||||
// The `Parser` derive is for ruff_dev, for ruff `Args` would be sufficient
|
||||
#[derive(Clone, Debug, clap::Parser)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
pub struct CheckCommand {
|
||||
/// List of files or directories to check.
|
||||
#[clap(help = "List of files or directories to check [default: .]")]
|
||||
|
@ -446,7 +446,7 @@ pub struct CheckCommand {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, clap::Parser)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
pub struct FormatCommand {
|
||||
/// List of files or directories to format.
|
||||
#[clap(help = "List of files or directories to format [default: .]")]
|
||||
|
@ -560,7 +560,7 @@ pub enum HelpFormat {
|
|||
Json,
|
||||
}
|
||||
|
||||
#[allow(clippy::module_name_repetitions)]
|
||||
#[expect(clippy::module_name_repetitions)]
|
||||
#[derive(Debug, Default, Clone, clap::Args)]
|
||||
pub struct LogLevelArgs {
|
||||
/// Enable verbose logging.
|
||||
|
@ -1031,7 +1031,7 @@ Possible choices:
|
|||
|
||||
/// CLI settings that are distinct from configuration (commands, lists of files,
|
||||
/// etc.).
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
pub struct CheckArguments {
|
||||
pub add_noqa: bool,
|
||||
pub diff: bool,
|
||||
|
@ -1050,7 +1050,7 @@ pub struct CheckArguments {
|
|||
|
||||
/// CLI settings that are distinct from configuration (commands, lists of files,
|
||||
/// etc.).
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
pub struct FormatArguments {
|
||||
pub check: bool,
|
||||
pub no_cache: bool,
|
||||
|
@ -1271,7 +1271,6 @@ pub struct AnalyzeGraphArgs {
|
|||
/// Configuration overrides provided via dedicated CLI flags:
|
||||
/// `--line-length`, `--respect-gitignore`, etc.
|
||||
#[derive(Clone, Default)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
struct ExplicitConfigOverrides {
|
||||
dummy_variable_rgx: Option<Regex>,
|
||||
exclude: Option<Vec<FilePattern>>,
|
||||
|
|
|
@ -86,7 +86,7 @@ pub(crate) struct Cache {
|
|||
changes: Mutex<Vec<Change>>,
|
||||
/// The "current" timestamp used as cache for the updates of
|
||||
/// [`FileCache::last_seen`]
|
||||
#[allow(clippy::struct_field_names)]
|
||||
#[expect(clippy::struct_field_names)]
|
||||
last_seen_cache: u64,
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ impl Cache {
|
|||
Cache::new(path, package)
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
fn new(path: PathBuf, package: PackageCache) -> Self {
|
||||
Cache {
|
||||
path,
|
||||
|
@ -204,7 +204,7 @@ impl Cache {
|
|||
}
|
||||
|
||||
/// Applies the pending changes without storing the cache to disk.
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
pub(crate) fn save(&mut self) -> bool {
|
||||
/// Maximum duration for which we keep a file in cache that hasn't been seen.
|
||||
const MAX_LAST_SEEN: Duration = Duration::from_secs(30 * 24 * 60 * 60); // 30 days.
|
||||
|
@ -834,7 +834,6 @@ mod tests {
|
|||
// Regression test for issue #3086.
|
||||
|
||||
#[cfg(unix)]
|
||||
#[allow(clippy::items_after_statements)]
|
||||
fn flip_execute_permission_bit(path: &Path) -> io::Result<()> {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let file = fs::OpenOptions::new().write(true).open(path)?;
|
||||
|
@ -843,7 +842,6 @@ mod tests {
|
|||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[allow(clippy::items_after_statements)]
|
||||
fn flip_read_only_permission(path: &Path) -> io::Result<()> {
|
||||
let file = fs::OpenOptions::new().write(true).open(path)?;
|
||||
let mut perms = file.metadata()?.permissions();
|
||||
|
|
|
@ -30,7 +30,6 @@ use crate::cache::{Cache, PackageCacheMap, PackageCaches};
|
|||
use crate::diagnostics::Diagnostics;
|
||||
|
||||
/// Run the linter over a collection of files.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn check(
|
||||
files: &[PathBuf],
|
||||
pyproject_config: &PyprojectConfig,
|
||||
|
@ -181,7 +180,6 @@ pub(crate) fn check(
|
|||
|
||||
/// Wraps [`lint_path`](crate::diagnostics::lint_path) in a [`catch_unwind`](std::panic::catch_unwind) and emits
|
||||
/// a diagnostic if the linting the file panics.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn lint_path(
|
||||
path: &Path,
|
||||
package: Option<PackageRoot<'_>>,
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::args::HelpFormat;
|
|||
use ruff_workspace::options::Options;
|
||||
use ruff_workspace::options_base::OptionsMetadata;
|
||||
|
||||
#[allow(clippy::print_stdout)]
|
||||
#[expect(clippy::print_stdout)]
|
||||
pub(crate) fn config(key: Option<&str>, format: HelpFormat) -> Result<()> {
|
||||
match key {
|
||||
None => {
|
||||
|
|
|
@ -362,7 +362,7 @@ pub(crate) fn format_source(
|
|||
})
|
||||
} else {
|
||||
// Using `Printed::into_code` requires adding `ruff_formatter` as a direct dependency, and I suspect that Rust can optimize the closure away regardless.
|
||||
#[allow(clippy::redundant_closure_for_method_calls)]
|
||||
#[expect(clippy::redundant_closure_for_method_calls)]
|
||||
format_module_source(unformatted, options).map(|formatted| formatted.into_code())
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Explanation<'a> {
|
|||
summary: &'a str,
|
||||
message_formats: &'a [&'a str],
|
||||
fix: String,
|
||||
#[allow(clippy::struct_field_names)]
|
||||
#[expect(clippy::struct_field_names)]
|
||||
explanation: Option<&'a str>,
|
||||
preview: bool,
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ pub fn run(
|
|||
{
|
||||
let default_panic_hook = std::panic::take_hook();
|
||||
std::panic::set_hook(Box::new(move |info| {
|
||||
#[allow(clippy::print_stderr)]
|
||||
#[expect(clippy::print_stderr)]
|
||||
{
|
||||
eprintln!(
|
||||
r#"
|
||||
|
@ -326,7 +326,7 @@ pub fn check(args: CheckCommand, global_options: GlobalConfigArgs) -> Result<Exi
|
|||
commands::add_noqa::add_noqa(&files, &pyproject_config, &config_arguments)?;
|
||||
if modifications > 0 && config_arguments.log_level >= LogLevel::Default {
|
||||
let s = if modifications == 1 { "" } else { "s" };
|
||||
#[allow(clippy::print_stderr)]
|
||||
#[expect(clippy::print_stderr)]
|
||||
{
|
||||
eprintln!("Added {modifications} noqa directive{s}.");
|
||||
}
|
||||
|
|
|
@ -241,7 +241,6 @@ impl Printer {
|
|||
}
|
||||
|
||||
if !self.flags.intersects(Flags::SHOW_VIOLATIONS) {
|
||||
#[allow(deprecated)]
|
||||
if matches!(
|
||||
self.format,
|
||||
OutputFormat::Full | OutputFormat::Concise | OutputFormat::Grouped
|
||||
|
|
|
@ -45,9 +45,9 @@ static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
|||
target_arch = "powerpc64"
|
||||
)
|
||||
))]
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[expect(non_upper_case_globals)]
|
||||
#[export_name = "_rjem_malloc_conf"]
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
pub static _rjem_malloc_conf: &[u8] = b"dirty_decay_ms:-1,muzzy_decay_ms:-1\0";
|
||||
|
||||
fn create_test_cases() -> Vec<TestCase> {
|
||||
|
|
|
@ -213,7 +213,7 @@ macro_rules! impl_cache_key_tuple {
|
|||
|
||||
( $($name:ident)+) => (
|
||||
impl<$($name: CacheKey),+> CacheKey for ($($name,)+) where last_type!($($name,)+): ?Sized {
|
||||
#[allow(non_snake_case)]
|
||||
#[expect(non_snake_case)]
|
||||
#[inline]
|
||||
fn cache_key(&self, state: &mut CacheKeyHasher) {
|
||||
let ($(ref $name,)+) = *self;
|
||||
|
|
|
@ -47,7 +47,7 @@ fn struct_ignored_fields() {
|
|||
struct NamedFieldsStruct {
|
||||
a: String,
|
||||
#[cache_key(ignore)]
|
||||
#[allow(unused)]
|
||||
#[expect(unused)]
|
||||
b: String,
|
||||
}
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ struct Renderable<'r> {
|
|||
// (At time of writing, 2025-03-13, we currently render the diagnostic
|
||||
// ID into the main message of the parent diagnostic. We don't use this
|
||||
// specific field to do that though.)
|
||||
#[allow(dead_code)]
|
||||
#[expect(dead_code)]
|
||||
id: &'r str,
|
||||
diagnostics: Vec<RenderableDiagnostic<'r>>,
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ impl OsSystem {
|
|||
|
||||
Self {
|
||||
// Spreading `..Default` because it isn't possible to feature gate the initializer of a single field.
|
||||
#[allow(clippy::needless_update)]
|
||||
inner: Arc::new(OsSystemInner {
|
||||
cwd: cwd.to_path_buf(),
|
||||
case_sensitivity,
|
||||
|
|
|
@ -35,7 +35,7 @@ impl WalkDirectoryBuilder {
|
|||
/// Each additional path is traversed recursively.
|
||||
/// This should be preferred over building multiple
|
||||
/// walkers since it enables reusing resources.
|
||||
#[allow(clippy::should_implement_trait)]
|
||||
#[expect(clippy::should_implement_trait)]
|
||||
pub fn add(mut self, path: impl AsRef<SystemPath>) -> Self {
|
||||
self.paths.push(path.as_ref().to_path_buf());
|
||||
self
|
||||
|
|
|
@ -172,7 +172,7 @@ impl Default for VendoredFileSystem {
|
|||
/// that users of the `VendoredFileSystem` could realistically need.
|
||||
/// For debugging purposes, however, we want to have all information
|
||||
/// available.
|
||||
#[allow(unused)]
|
||||
#[expect(unused)]
|
||||
#[derive(Debug)]
|
||||
struct ZipFileDebugInfo {
|
||||
crc32_hash: u32,
|
||||
|
|
|
@ -63,7 +63,6 @@ fn find_pyproject_config(
|
|||
}
|
||||
|
||||
/// Find files that ruff would check so we can format them. Adapted from `ruff`.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn ruff_check_paths<'a>(
|
||||
pyproject_config: &'a PyprojectConfig,
|
||||
cli: &FormatArguments,
|
||||
|
@ -135,12 +134,12 @@ impl Statistics {
|
|||
}
|
||||
|
||||
/// We currently prefer the similarity index, but i'd like to keep this around
|
||||
#[allow(clippy::cast_precision_loss, unused)]
|
||||
#[expect(clippy::cast_precision_loss, unused)]
|
||||
pub(crate) fn jaccard_index(&self) -> f32 {
|
||||
self.intersection as f32 / (self.black_input + self.ruff_output + self.intersection) as f32
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_precision_loss)]
|
||||
#[expect(clippy::cast_precision_loss)]
|
||||
pub(crate) fn similarity_index(&self) -> f32 {
|
||||
self.intersection as f32 / (self.black_input + self.intersection) as f32
|
||||
}
|
||||
|
@ -177,7 +176,7 @@ pub(crate) enum Format {
|
|||
Full,
|
||||
}
|
||||
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
#[derive(clap::Args)]
|
||||
pub(crate) struct Args {
|
||||
/// Like `ruff check`'s files. See `--multi-project` if you want to format an ecosystem
|
||||
|
@ -222,7 +221,7 @@ pub(crate) struct Args {
|
|||
#[arg(long)]
|
||||
pub(crate) files_with_errors: Option<u32>,
|
||||
#[clap(flatten)]
|
||||
#[allow(clippy::struct_field_names)]
|
||||
#[expect(clippy::struct_field_names)]
|
||||
pub(crate) log_level_args: LogLevelArgs,
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ fn generate_table(table_out: &mut String, rules: impl IntoIterator<Item = Rule>,
|
|||
RuleGroup::Deprecated => {
|
||||
format!("<span title='Rule has been deprecated'>{WARNING_SYMBOL}</span>")
|
||||
}
|
||||
#[allow(deprecated)]
|
||||
RuleGroup::Preview => {
|
||||
format!("<span title='Rule is in preview'>{PREVIEW_SYMBOL}</span>")
|
||||
}
|
||||
|
@ -78,7 +77,7 @@ fn generate_table(table_out: &mut String, rules: impl IntoIterator<Item = Rule>,
|
|||
se = "</span>";
|
||||
}
|
||||
|
||||
#[allow(clippy::or_fun_call)]
|
||||
#[expect(clippy::or_fun_call)]
|
||||
let _ = write!(
|
||||
table_out,
|
||||
"| {ss}{0}{1}{se} {{ #{0}{1} }} | {ss}{2}{se} | {ss}{3}{se} | {ss}{4}{se} |",
|
||||
|
|
|
@ -34,7 +34,7 @@ struct Args {
|
|||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[expect(clippy::large_enum_variant)]
|
||||
enum Command {
|
||||
/// Run all code and documentation generation steps.
|
||||
GenerateAll(generate_all::Args),
|
||||
|
@ -82,7 +82,7 @@ fn main() -> Result<ExitCode> {
|
|||
command,
|
||||
global_options,
|
||||
} = Args::parse();
|
||||
#[allow(clippy::print_stdout)]
|
||||
#[expect(clippy::print_stdout)]
|
||||
match command {
|
||||
Command::GenerateAll(args) => generate_all::main(&args)?,
|
||||
Command::GenerateJSONSchema(args) => generate_json_schema::main(&args)?,
|
||||
|
|
|
@ -519,7 +519,7 @@ impl TextWidth {
|
|||
let char_width = match c {
|
||||
'\t' => indent_width.value(),
|
||||
'\n' => return TextWidth::Multiline,
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
c => c.width().unwrap_or(0) as u32,
|
||||
};
|
||||
width += char_width;
|
||||
|
|
|
@ -280,7 +280,7 @@ impl Format<IrFormatContext<'_>> for &[FormatElement] {
|
|||
| FormatElement::SourceCodeSlice { .. }) => {
|
||||
fn write_escaped(element: &FormatElement, f: &mut Formatter<IrFormatContext>) {
|
||||
let (text, text_width) = match element {
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
FormatElement::Token { text } => {
|
||||
(*text, TextWidth::Width(Width::new(text.len() as u32)))
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ impl PartialEq for LabelId {
|
|||
}
|
||||
|
||||
impl LabelId {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn of<T: LabelDefinition>(label: T) -> Self {
|
||||
Self {
|
||||
value: label.value(),
|
||||
|
|
|
@ -925,7 +925,7 @@ pub struct FormatState<Context> {
|
|||
group_id_builder: UniqueGroupIdBuilder,
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_fields_in_debug)]
|
||||
#[expect(clippy::missing_fields_in_debug)]
|
||||
impl<Context> std::fmt::Debug for FormatState<Context>
|
||||
where
|
||||
Context: std::fmt::Debug,
|
||||
|
|
|
@ -331,7 +331,7 @@ impl<'a> Printer<'a> {
|
|||
FormatElement::Tag(StartVerbatim(kind)) => {
|
||||
if let VerbatimKind::Verbatim { length } = kind {
|
||||
// SAFETY: Ruff only supports formatting files <= 4GB
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
self.state.verbatim_markers.push(TextRange::at(
|
||||
TextSize::from(self.state.buffer.len() as u32),
|
||||
*length,
|
||||
|
@ -464,7 +464,7 @@ impl<'a> Printer<'a> {
|
|||
self.push_marker();
|
||||
|
||||
match text {
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
Text::Token(token) => {
|
||||
self.state.buffer.push_str(token);
|
||||
self.state.line_width += token.len() as u32;
|
||||
|
@ -831,7 +831,7 @@ impl<'a> Printer<'a> {
|
|||
} else {
|
||||
self.state.buffer.push(char);
|
||||
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
let char_width = if char == '\t' {
|
||||
self.options.indent_width.value()
|
||||
} else {
|
||||
|
@ -1480,7 +1480,7 @@ impl<'a, 'print> FitsMeasurer<'a, 'print> {
|
|||
u32::from(indent.level()) * self.options().indent_width() + u32::from(indent.align());
|
||||
|
||||
match text {
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
Text::Token(token) => {
|
||||
self.state.line_width += token.len() as u32;
|
||||
}
|
||||
|
@ -1511,7 +1511,7 @@ impl<'a, 'print> FitsMeasurer<'a, 'print> {
|
|||
}
|
||||
}
|
||||
// SAFETY: A u32 is sufficient to format files <= 4GB
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
c => c.width().unwrap_or(0) as u32,
|
||||
};
|
||||
self.state.line_width += char_width;
|
||||
|
|
|
@ -22,7 +22,7 @@ impl<I: Idx, T> IndexSlice<I, T> {
|
|||
pub const fn from_raw(raw: &[T]) -> &Self {
|
||||
let ptr: *const [T] = raw;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
// SAFETY: `IndexSlice` is `repr(transparent)` over a normal slice
|
||||
unsafe {
|
||||
&*(ptr as *const Self)
|
||||
|
@ -33,7 +33,7 @@ impl<I: Idx, T> IndexSlice<I, T> {
|
|||
pub fn from_raw_mut(raw: &mut [T]) -> &mut Self {
|
||||
let ptr: *mut [T] = raw;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
// SAFETY: `IndexSlice` is `repr(transparent)` over a normal slice
|
||||
unsafe {
|
||||
&mut *(ptr as *mut Self)
|
||||
|
@ -209,5 +209,5 @@ impl<I: Idx, T> Default for &mut IndexSlice<I, T> {
|
|||
|
||||
// Whether `IndexSlice` is `Send` depends only on the data,
|
||||
// not the phantom data.
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
unsafe impl<I: Idx, T> Send for IndexSlice<I, T> where T: Send {}
|
||||
|
|
|
@ -179,16 +179,16 @@ impl<I: Idx, T, const N: usize> From<[T; N]> for IndexVec<I, T> {
|
|||
|
||||
// Whether `IndexVec` is `Send` depends only on the data,
|
||||
// not the phantom data.
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
unsafe impl<I: Idx, T> Send for IndexVec<I, T> where T: Send {}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
#[cfg(feature = "salsa")]
|
||||
unsafe impl<I, T> salsa::Update for IndexVec<I, T>
|
||||
where
|
||||
T: salsa::Update,
|
||||
{
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool {
|
||||
let old_vec: &mut IndexVec<I, T> = unsafe { &mut *old_pointer };
|
||||
salsa::Update::maybe_update(&mut old_vec.raw, new_value.raw)
|
||||
|
|
|
@ -184,7 +184,7 @@ pub(crate) fn definitions(checker: &mut Checker) {
|
|||
|
||||
// We don't recognise implicitly concatenated strings as valid docstrings in our model currently.
|
||||
let Some(sole_string_part) = string_literal.as_single_part_string() else {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let location = checker
|
||||
.locator
|
||||
.compute_source_location(string_literal.start());
|
||||
|
|
|
@ -234,14 +234,14 @@ pub(crate) struct Checker<'a> {
|
|||
/// The target [`PythonVersion`] for version-dependent checks.
|
||||
target_version: PythonVersion,
|
||||
/// Helper visitor for detecting semantic syntax errors.
|
||||
#[allow(clippy::struct_field_names)]
|
||||
#[expect(clippy::struct_field_names)]
|
||||
semantic_checker: SemanticSyntaxChecker,
|
||||
/// Errors collected by the `semantic_checker`.
|
||||
semantic_errors: RefCell<Vec<SemanticSyntaxError>>,
|
||||
}
|
||||
|
||||
impl<'a> Checker<'a> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn new(
|
||||
parsed: &'a Parsed<ModModule>,
|
||||
parsed_annotations_arena: &'a typed_arena::Arena<Result<ParsedAnnotation, ParseError>>,
|
||||
|
@ -362,7 +362,7 @@ impl<'a> Checker<'a> {
|
|||
|
||||
/// Returns the [`SourceRow`] for the given offset.
|
||||
pub(crate) fn compute_source_row(&self, offset: TextSize) -> SourceRow {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let line = self.locator.compute_line_index(offset);
|
||||
|
||||
if let Some(notebook_index) = self.notebook_index {
|
||||
|
@ -2909,7 +2909,7 @@ impl<'a> ParsedAnnotationsCache<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn check_ast(
|
||||
parsed: &Parsed<ModModule>,
|
||||
locator: &Locator,
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::rules::isort::block::{Block, BlockBuilder};
|
|||
use crate::settings::LinterSettings;
|
||||
use crate::Locator;
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn check_imports(
|
||||
parsed: &Parsed<ModModule>,
|
||||
locator: &Locator,
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::rules::ruff::rules::{UnusedCodes, UnusedNOQA};
|
|||
use crate::settings::LinterSettings;
|
||||
use crate::Locator;
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn check_noqa(
|
||||
diagnostics: &mut Vec<Diagnostic>,
|
||||
path: &Path,
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::rules::{
|
|||
use crate::settings::LinterSettings;
|
||||
use crate::Locator;
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn check_tokens(
|
||||
tokens: &Tokens,
|
||||
path: &Path,
|
||||
|
|
|
@ -61,7 +61,7 @@ pub enum RuleGroup {
|
|||
|
||||
#[ruff_macros::map_codes]
|
||||
pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||
#[allow(clippy::enum_glob_use)]
|
||||
#[expect(clippy::enum_glob_use)]
|
||||
use Linter::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
|
|
|
@ -418,7 +418,7 @@ fn suspected_as_section(line: &str, style: SectionStyle) -> Option<SectionKind>
|
|||
}
|
||||
|
||||
/// Check if the suspected context is really a section header.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn is_docstring_section(
|
||||
line: &Line,
|
||||
indent_size: TextSize,
|
||||
|
|
|
@ -172,7 +172,6 @@ mod tests {
|
|||
use crate::rules::pycodestyle::rules::MissingNewlineAtEndOfFile;
|
||||
use crate::Locator;
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn create_diagnostics(
|
||||
filename: &str,
|
||||
source: &str,
|
||||
|
|
|
@ -98,7 +98,7 @@ pub struct FixerResult<'a> {
|
|||
}
|
||||
|
||||
/// Generate [`Message`]s from the source code contents at the given `Path`.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn check_path(
|
||||
path: &Path,
|
||||
package: Option<PackageRoot<'_>>,
|
||||
|
@ -538,7 +538,6 @@ fn diagnostics_to_messages(
|
|||
|
||||
/// Generate `Diagnostic`s from source code content, iteratively fixing
|
||||
/// until stable.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn lint_fix<'a>(
|
||||
path: &Path,
|
||||
package: Option<PackageRoot<'_>>,
|
||||
|
@ -672,7 +671,7 @@ fn collect_rule_codes(rules: impl IntoIterator<Item = Rule>) -> String {
|
|||
.join(", ")
|
||||
}
|
||||
|
||||
#[allow(clippy::print_stderr)]
|
||||
#[expect(clippy::print_stderr)]
|
||||
fn report_failed_to_converge_error(path: &Path, transformed: &str, messages: &[Message]) {
|
||||
let codes = collect_rule_codes(messages.iter().filter_map(Message::rule));
|
||||
if cfg!(debug_assertions) {
|
||||
|
@ -705,7 +704,7 @@ This indicates a bug in Ruff. If you could open an issue at:
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::print_stderr)]
|
||||
#[expect(clippy::print_stderr)]
|
||||
fn report_fix_syntax_error(
|
||||
path: &Path,
|
||||
transformed: &str,
|
||||
|
|
|
@ -109,7 +109,7 @@ pub enum LogLevel {
|
|||
}
|
||||
|
||||
impl LogLevel {
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
#[expect(clippy::trivially_copy_pass_by_ref)]
|
||||
const fn level_filter(&self) -> log::LevelFilter {
|
||||
match self {
|
||||
LogLevel::Default => log::LevelFilter::Info,
|
||||
|
|
|
@ -137,7 +137,7 @@ impl SarifResult {
|
|||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
#[expect(clippy::unnecessary_wraps)]
|
||||
fn from_message(message: &Message) -> Result<Self> {
|
||||
let start_location = message.compute_start_location();
|
||||
let end_location = message.compute_end_location();
|
||||
|
|
|
@ -238,7 +238,7 @@ impl<'a> FileNoqaDirectives<'a> {
|
|||
let no_indentation_at_offset =
|
||||
indentation_at_offset(range.start(), locator.contents()).is_none();
|
||||
if !warnings.is_empty() || no_indentation_at_offset {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let line = locator.compute_line_index(range.start());
|
||||
let path_display = relativize_path(path);
|
||||
|
||||
|
@ -268,7 +268,7 @@ impl<'a> FileNoqaDirectives<'a> {
|
|||
{
|
||||
Some(rule.noqa_code())
|
||||
} else {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let line = locator.compute_line_index(range.start());
|
||||
let path_display = relativize_path(path);
|
||||
warn!("Invalid rule code provided to `# ruff: noqa` at {path_display}:{line}: {code}");
|
||||
|
@ -285,7 +285,7 @@ impl<'a> FileNoqaDirectives<'a> {
|
|||
});
|
||||
}
|
||||
Err(err) => {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let line = locator.compute_line_index(range.start());
|
||||
let path_display = relativize_path(path);
|
||||
warn!("Invalid `# ruff: noqa` directive at {path_display}:{line}: {err}");
|
||||
|
@ -1053,7 +1053,7 @@ impl<'a> NoqaDirectives<'a> {
|
|||
directive,
|
||||
})) => {
|
||||
if !warnings.is_empty() {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let line = locator.compute_line_index(range.start());
|
||||
let path_display = relativize_path(path);
|
||||
for warning in warnings {
|
||||
|
@ -1073,7 +1073,7 @@ impl<'a> NoqaDirectives<'a> {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let line = locator.compute_line_index(range.start());
|
||||
let path_display = relativize_path(path);
|
||||
warn!("Invalid rule code provided to `# noqa` at {path_display}:{line}: {code}");
|
||||
|
@ -1091,7 +1091,7 @@ impl<'a> NoqaDirectives<'a> {
|
|||
});
|
||||
}
|
||||
Err(err) => {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let line = locator.compute_line_index(range.start());
|
||||
let path_display = relativize_path(path);
|
||||
warn!("Invalid `# noqa` directive on {path_display}:{line}: {err}");
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct RuleSet([u64; RULESET_SIZE]);
|
|||
impl RuleSet {
|
||||
const EMPTY: [u64; RULESET_SIZE] = [0; RULESET_SIZE];
|
||||
// 64 fits into a u16 without truncation
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
const SLICE_BITS: u16 = u64::BITS as u16;
|
||||
|
||||
/// Returns an empty rule set.
|
||||
|
@ -361,14 +361,14 @@ impl Iterator for RuleSetIterator {
|
|||
loop {
|
||||
let slice = self.set.0.get_mut(self.index as usize)?;
|
||||
// `trailing_zeros` is guaranteed to return a value in [0;64]
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
let bit = slice.trailing_zeros() as u16;
|
||||
|
||||
if bit < RuleSet::SLICE_BITS {
|
||||
*slice ^= 1 << bit;
|
||||
let rule_value = self.index * RuleSet::SLICE_BITS + bit;
|
||||
// SAFETY: RuleSet guarantees that only valid rules are stored in the set.
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
return Some(unsafe { std::mem::transmute::<u16, Rule>(rule_value) });
|
||||
}
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ mod schema {
|
|||
.filter(|_rule| {
|
||||
// Filter out all test-only rules
|
||||
#[cfg(any(feature = "test-rules", test))]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
#[expect(clippy::used_underscore_binding)]
|
||||
if _rule.starts_with("RUF9") || _rule == "PLW0101" {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ impl Violation for FastApiUnusedPathParameter {
|
|||
function_name,
|
||||
is_positional,
|
||||
} = self;
|
||||
#[allow(clippy::if_not_else)]
|
||||
#[expect(clippy::if_not_else)]
|
||||
if !is_positional {
|
||||
format!("Parameter `{arg_name}` appears in route path, but not in `{function_name}` signature")
|
||||
} else {
|
||||
|
@ -190,7 +190,7 @@ pub(crate) fn fastapi_unused_path_parameter(
|
|||
function_name: function_def.name.to_string(),
|
||||
is_positional,
|
||||
},
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
diagnostic_range
|
||||
.add_start(TextSize::from(range.start as u32 + 1))
|
||||
.sub_end(TextSize::from((path.len() - range.end + 1) as u32)),
|
||||
|
@ -424,7 +424,7 @@ impl<'a> Iterator for PathParamIterator<'a> {
|
|||
let param_name_end = param_content.find(':').unwrap_or(param_content.len());
|
||||
let param_name = ¶m_content[..param_name_end].trim();
|
||||
|
||||
#[allow(clippy::range_plus_one)]
|
||||
#[expect(clippy::range_plus_one)]
|
||||
return Some((param_name, start..end + 1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ impl Violation for MissingTypeKwargs {
|
|||
#[deprecated(note = "ANN101 has been removed")]
|
||||
pub(crate) struct MissingTypeSelf;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
impl Violation for MissingTypeSelf {
|
||||
fn message(&self) -> String {
|
||||
unreachable!("ANN101 has been removed");
|
||||
|
@ -194,7 +194,7 @@ impl Violation for MissingTypeSelf {
|
|||
#[deprecated(note = "ANN102 has been removed")]
|
||||
pub(crate) struct MissingTypeCls;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
impl Violation for MissingTypeCls {
|
||||
fn message(&self) -> String {
|
||||
unreachable!("ANN102 has been removed")
|
||||
|
|
|
@ -5,7 +5,7 @@ use ruff_macros::CacheKey;
|
|||
use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Debug, Clone, Default, CacheKey)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
pub struct Settings {
|
||||
pub mypy_init_return: bool,
|
||||
pub suppress_dummy_args: bool,
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::checkers::ast::Checker;
|
|||
use crate::rules::flake8_async::helpers::AsyncModule;
|
||||
use ruff_python_ast::PythonVersion;
|
||||
|
||||
#[allow(clippy::doc_link_with_quotes)]
|
||||
#[expect(clippy::doc_link_with_quotes)]
|
||||
/// ## What it does
|
||||
/// Checks for `async` function definitions with `timeout` parameters.
|
||||
///
|
||||
|
|
|
@ -92,7 +92,7 @@ pub(crate) fn long_sleep_not_forever(checker: &Checker, call: &ExprCall) {
|
|||
}
|
||||
Number::Float(float_value) =>
|
||||
{
|
||||
#[allow(clippy::cast_precision_loss)]
|
||||
#[expect(clippy::cast_precision_loss)]
|
||||
if *float_value <= one_day_in_secs as f64 {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ pub(crate) fn mutable_argument_default(checker: &Checker, function_def: &ast::St
|
|||
|
||||
/// Generate a [`Fix`] to move a mutable argument default initialization
|
||||
/// into the function body.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn move_initialization(
|
||||
function_def: &ast::StmtFunctionDef,
|
||||
parameter: &Parameter,
|
||||
|
|
|
@ -74,7 +74,7 @@ impl From<(TokenKind, TextRange)> for SimpleToken {
|
|||
TokenKind::Import => TokenType::Named,
|
||||
_ => TokenType::Irrelevant,
|
||||
};
|
||||
#[allow(clippy::inconsistent_struct_constructor)]
|
||||
#[expect(clippy::inconsistent_struct_constructor)]
|
||||
Self { range, ty }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ impl AlwaysFixableViolation for PytestExtraneousScopeFunction {
|
|||
#[deprecated(note = "PT004 has been removed")]
|
||||
pub(crate) struct PytestMissingFixtureNameUnderscore;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
impl Violation for PytestMissingFixtureNameUnderscore {
|
||||
fn message(&self) -> String {
|
||||
unreachable!("PT004 has been removed");
|
||||
|
@ -283,7 +283,7 @@ impl Violation for PytestMissingFixtureNameUnderscore {
|
|||
#[deprecated(note = "PT005 has been removed")]
|
||||
pub(crate) struct PytestIncorrectFixtureNameUnderscore;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
impl Violation for PytestIncorrectFixtureNameUnderscore {
|
||||
fn message(&self) -> String {
|
||||
unreachable!("PT005 has been removed");
|
||||
|
|
|
@ -79,16 +79,16 @@ enum Reason<'a> {
|
|||
Future,
|
||||
KnownStandardLibrary,
|
||||
SamePackage,
|
||||
#[allow(dead_code)]
|
||||
#[expect(dead_code)]
|
||||
SourceMatch(&'a Path),
|
||||
NoMatch,
|
||||
UserDefinedSection,
|
||||
NoSections,
|
||||
#[allow(dead_code)]
|
||||
#[expect(dead_code)]
|
||||
DisabledSection(&'a ImportSection),
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn categorize<'a>(
|
||||
module_name: &str,
|
||||
is_relative: bool,
|
||||
|
@ -172,7 +172,7 @@ fn match_sources<'a>(paths: &'a [PathBuf], base: &str) -> Option<&'a Path> {
|
|||
None
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn categorize_imports<'a>(
|
||||
block: ImportBlock<'a>,
|
||||
src: &[PathBuf],
|
||||
|
|
|
@ -40,7 +40,7 @@ pub(crate) fn format_import(
|
|||
}
|
||||
|
||||
/// Add an import-from statement to the [`RopeBuilder`].
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn format_import_from(
|
||||
import_from: &ImportFromData,
|
||||
comments: &ImportFromCommentSet,
|
||||
|
|
|
@ -63,7 +63,7 @@ pub(crate) enum AnnotatedImport<'a> {
|
|||
},
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn format_imports(
|
||||
block: &Block,
|
||||
comments: Vec<Comment>,
|
||||
|
@ -149,7 +149,7 @@ pub(crate) fn format_imports(
|
|||
output
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn format_import_block(
|
||||
block: ImportBlock,
|
||||
line_length: LineLength,
|
||||
|
|
|
@ -85,7 +85,6 @@ fn includes_import(stmt: &Stmt, target: &NameImport) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn add_required_import(
|
||||
required_import: &NameImport,
|
||||
parsed: &Parsed<ModModule>,
|
||||
|
|
|
@ -77,7 +77,7 @@ fn matches_ignoring_indentation(val1: &str, val2: &str) -> bool {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_sign_loss, clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
/// I001
|
||||
pub(crate) fn organize_imports(
|
||||
block: &Block,
|
||||
|
|
|
@ -45,7 +45,7 @@ impl Display for RelativeImportsOrder {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, CacheKey)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
pub struct Settings {
|
||||
pub required_imports: BTreeSet<NameImport>,
|
||||
pub combine_as_imports: bool,
|
||||
|
|
|
@ -143,7 +143,7 @@ impl Violation for InvalidFirstArgumentNameForClassMethod {
|
|||
#[derive_message_formats]
|
||||
// The first string below is what shows up in the documentation
|
||||
// in the rule table, and it is the more common case.
|
||||
#[allow(clippy::if_not_else)]
|
||||
#[expect(clippy::if_not_else)]
|
||||
fn message(&self) -> String {
|
||||
if !self.is_new {
|
||||
"First argument of a class method should be named `cls`".to_string()
|
||||
|
|
|
@ -818,7 +818,7 @@ impl<'a> BlankLinesChecker<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::nonminimal_bool)]
|
||||
#[expect(clippy::nonminimal_bool)]
|
||||
fn check_line(
|
||||
&self,
|
||||
line: &LogicalLineInfo,
|
||||
|
|
|
@ -66,7 +66,7 @@ impl Violation for IOError {
|
|||
#[deprecated(note = "E999 has been removed")]
|
||||
pub(crate) struct SyntaxError;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
impl Violation for SyntaxError {
|
||||
fn message(&self) -> String {
|
||||
unreachable!("E999 has been removed")
|
||||
|
|
|
@ -392,7 +392,6 @@ impl LogicalLinesBuilder {
|
|||
}
|
||||
|
||||
// SAFETY: `LogicalLines::from_tokens` asserts that the file has less than `u32::MAX` tokens and each tokens is at least one character long
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
fn push_token(&mut self, kind: TokenKind, range: TextRange) {
|
||||
let line = &mut self.current_line;
|
||||
|
||||
|
@ -428,7 +427,7 @@ impl LogicalLinesBuilder {
|
|||
}
|
||||
|
||||
// SAFETY: `LogicalLines::from_tokens` asserts that the file has less than `u32::MAX` tokens and each tokens is at least one character long
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
fn finish_line(&mut self) {
|
||||
let end = self.tokens.len() as u32;
|
||||
if self.current_line.tokens_start < end {
|
||||
|
|
|
@ -523,7 +523,7 @@ impl Ranged for YieldEntry {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[expect(clippy::enum_variant_names)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
enum ReturnEntryKind {
|
||||
NotNone,
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::checkers::ast::Checker;
|
|||
use crate::docstrings::Docstring;
|
||||
use crate::registry::Rule;
|
||||
|
||||
#[allow(clippy::tabs_in_doc_comments)]
|
||||
#[expect(clippy::tabs_in_doc_comments)]
|
||||
/// ## What it does
|
||||
/// Checks for docstrings that are indented with tabs.
|
||||
///
|
||||
|
|
|
@ -151,7 +151,7 @@ fn is_typing(reference: &ResolvedReference) -> bool {
|
|||
|| reference.in_runtime_evaluated_annotation()
|
||||
}
|
||||
|
||||
#[allow(clippy::struct_field_names)]
|
||||
#[expect(clippy::struct_field_names)]
|
||||
struct ImportInfo<'a> {
|
||||
module_name: &'a [&'a str],
|
||||
member_name: Cow<'a, str>,
|
||||
|
|
|
@ -89,7 +89,7 @@ fn is_magic_value(literal_expr: LiteralExpressionRef, allowed_types: &[ConstantT
|
|||
!matches!(value.to_str(), "" | "__main__")
|
||||
}
|
||||
LiteralExpressionRef::NumberLiteral(ast::ExprNumberLiteral { value, .. }) => match value {
|
||||
#[allow(clippy::float_cmp)]
|
||||
#[expect(clippy::float_cmp)]
|
||||
ast::Number::Float(value) => !(*value == 0.0 || *value == 1.0),
|
||||
ast::Number::Int(value) => !matches!(*value, Int::ZERO | Int::ONE),
|
||||
ast::Number::Complex { .. } => true,
|
||||
|
|
|
@ -98,7 +98,7 @@ fn reachable(cfg: &ControlFlowGraph) -> HashSet<BlockId> {
|
|||
/// Returns `Some(true)` if the condition is always true, e.g. `if True`, same
|
||||
/// with `Some(false)` if it's never taken. If it can't be determined it returns
|
||||
/// `None`, e.g. `if i == 100`.
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
#[expect(clippy::unnecessary_wraps)]
|
||||
fn taken(condition: &Condition) -> Option<bool> {
|
||||
match condition {
|
||||
Condition::Always => Some(true),
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Violation for UselessImportAlias {
|
|||
|
||||
#[derive_message_formats]
|
||||
fn message(&self) -> String {
|
||||
#[allow(clippy::if_not_else)]
|
||||
#[expect(clippy::if_not_else)]
|
||||
if !self.required_import_conflict {
|
||||
"Import alias does not rename original package".to_string()
|
||||
} else {
|
||||
|
|
|
@ -105,7 +105,7 @@ enum Constant {
|
|||
}
|
||||
|
||||
impl Constant {
|
||||
#[allow(clippy::approx_constant)]
|
||||
#[expect(clippy::approx_constant)]
|
||||
fn from_value(value: f64) -> Option<Self> {
|
||||
if (3.14..3.15).contains(&value) {
|
||||
matches_constant(std::f64::consts::PI, value).then_some(Self::Pi)
|
||||
|
|
|
@ -129,7 +129,7 @@ fn is_number_literal(expr: &Expr, value: i8) -> bool {
|
|||
if let Number::Int(number) = &number_literal.value {
|
||||
return number.as_i8().is_some_and(|number| number == value);
|
||||
} else if let Number::Float(number) = number_literal.value {
|
||||
#[allow(clippy::float_cmp)]
|
||||
#[expect(clippy::float_cmp)]
|
||||
return number == f64::from(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,12 +249,12 @@ pub struct FilePatternSet {
|
|||
cache_key: u64,
|
||||
// This field is only for displaying the internals
|
||||
// of `set`.
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
#[expect(clippy::used_underscore_binding)]
|
||||
_set_internals: Vec<FilePattern>,
|
||||
}
|
||||
|
||||
impl FilePatternSet {
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
#[expect(clippy::used_underscore_binding)]
|
||||
pub fn try_from_iter<I>(patterns: I) -> Result<Self, anyhow::Error>
|
||||
where
|
||||
I: IntoIterator<Item = FilePattern>,
|
||||
|
|
|
@ -19,7 +19,7 @@ pub(crate) fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenS
|
|||
#[automatically_derived]
|
||||
impl crate::configuration::CombinePluginOptions for #ident {
|
||||
fn combine(self, other: Self) -> Self {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
Self {
|
||||
#(
|
||||
#output
|
||||
|
|
|
@ -48,7 +48,7 @@ pub(super) fn generate_newtype_index(item: ItemStruct) -> syn::Result<proc_macro
|
|||
//
|
||||
// N.B. We have to use the unchecked variant here because we're
|
||||
// in a const context and Option::unwrap isn't const yet.
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
Self(unsafe { std::num::NonZeroU32::new_unchecked((value as u32) + 1) })
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ pub(super) fn generate_newtype_index(item: ItemStruct) -> syn::Result<proc_macro
|
|||
//
|
||||
// N.B. We have to use the unchecked variant here because we're
|
||||
// in a const context and Option::unwrap isn't const yet.
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
Self(unsafe { std::num::NonZeroU32::new_unchecked(value + 1) })
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ pub(crate) fn violation_metadata(input: DeriveInput) -> syn::Result<TokenStream>
|
|||
|
||||
Ok(quote! {
|
||||
#[automatically_derived]
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
impl ruff_diagnostics::ViolationMetadata for #name {
|
||||
fn rule_name() -> &'static str {
|
||||
stringify!(#name)
|
||||
|
|
|
@ -226,7 +226,6 @@ pub struct PatternMatchOr<'a> {
|
|||
patterns: Vec<ComparablePattern<'a>>,
|
||||
}
|
||||
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
pub enum ComparablePattern<'a> {
|
||||
MatchValue(PatternMatchValue<'a>),
|
||||
|
|
|
@ -352,7 +352,7 @@ impl Deref for FStringLiteralElement {
|
|||
/// Transforms a value prior to formatting it.
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, is_macro::Is)]
|
||||
#[repr(i8)]
|
||||
#[allow(clippy::cast_possible_wrap)]
|
||||
#[expect(clippy::cast_possible_wrap)]
|
||||
pub enum ConversionFlag {
|
||||
/// No conversion
|
||||
None = -1, // CPython uses -1
|
||||
|
|
|
@ -1365,7 +1365,7 @@ impl<'a> Generator<'a> {
|
|||
|
||||
if !conversion.is_none() {
|
||||
self.p("!");
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
|
||||
self.p(&format!("{}", conversion as u8 as char));
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,6 @@ impl<'fmt, 'ast, 'buf> JoinCommaSeparatedBuilder<'fmt, 'ast, 'buf> {
|
|||
self
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn entries<T, I, F>(&mut self, entries: I) -> &mut Self
|
||||
where
|
||||
T: Ranged,
|
||||
|
|
|
@ -24,7 +24,7 @@ pub enum Emit {
|
|||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
#[allow(clippy::struct_excessive_bools)] // It's only the dev cli anyways
|
||||
#[expect(clippy::struct_excessive_bools)] // It's only the dev cli anyways
|
||||
pub struct Cli {
|
||||
/// Python files to format. If there are none, stdin will be used. `-` as stdin is not supported
|
||||
pub files: Vec<PathBuf>,
|
||||
|
|
|
@ -244,7 +244,6 @@ impl<K: std::hash::Hash + Eq, V> MultiMap<K, V> {
|
|||
}
|
||||
|
||||
/// Returns `true` if `key` has any *leading*, *dangling*, or *trailing* parts.
|
||||
#[allow(unused)]
|
||||
pub(super) fn has(&self, key: &K) -> bool {
|
||||
self.index.contains_key(key)
|
||||
}
|
||||
|
@ -542,7 +541,7 @@ impl PartIndex {
|
|||
// OK because:
|
||||
// * The `value < u32::MAX` guarantees that the add doesn't overflow.
|
||||
// * The `+ 1` guarantees that the index is not zero
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
Self(std::num::NonZeroU32::new((value as u32) + 1).expect("valid value"))
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,6 @@ impl<'a> PyFormatContext<'a> {
|
|||
}
|
||||
|
||||
/// Returns `true` if preview mode is enabled.
|
||||
#[allow(unused)]
|
||||
pub(crate) const fn is_preview(&self) -> bool {
|
||||
self.options.preview().is_enabled()
|
||||
}
|
||||
|
|
|
@ -571,7 +571,7 @@ impl<'a> FlatBinaryExpressionSlice<'a> {
|
|||
"Operand slice must contain at least one operand"
|
||||
);
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
unsafe {
|
||||
// SAFETY: `BinaryChainSlice` has the same layout as a slice because it uses `repr(transparent)`
|
||||
&*(std::ptr::from_ref::<[OperandOrOperator<'a>]>(slice)
|
||||
|
|
|
@ -523,7 +523,6 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for Expr {
|
|||
/// * The expression contains at least one parenthesized sub expression (optimization to avoid unnecessary work)
|
||||
///
|
||||
/// This mimics Black's [`_maybe_split_omitting_optional_parens`](https://github.com/psf/black/blob/d1248ca9beaf0ba526d265f4108836d89cf551b7/src/black/linegen.py#L746-L820)
|
||||
#[allow(clippy::if_same_then_else)]
|
||||
pub(crate) fn can_omit_optional_parentheses(expr: &Expr, context: &PyFormatContext) -> bool {
|
||||
let mut visitor = CanOmitOptionalParenthesesVisitor::new(context);
|
||||
visitor.visit_subexpression(expr);
|
||||
|
@ -679,7 +678,7 @@ impl<'input> CanOmitOptionalParenthesesVisitor<'input> {
|
|||
|
||||
// It's impossible for a file smaller or equal to 4GB to contain more than 2^32 comparisons
|
||||
// because each comparison requires a left operand, and `n` `operands` and right sides.
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
Expr::BoolOp(ast::ExprBoolOp {
|
||||
range: _,
|
||||
op: _,
|
||||
|
@ -702,7 +701,7 @@ impl<'input> CanOmitOptionalParenthesesVisitor<'input> {
|
|||
|
||||
// It's impossible for a file smaller or equal to 4GB to contain more than 2^32 comparisons
|
||||
// because each comparison requires a left operand, and `n` `operands` and right sides.
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
Expr::Compare(ast::ExprCompare {
|
||||
range: _,
|
||||
left: _,
|
||||
|
|
|
@ -14,7 +14,6 @@ pub(crate) fn read_from_stdin() -> Result<String> {
|
|||
Ok(buffer)
|
||||
}
|
||||
|
||||
#[allow(clippy::print_stdout)]
|
||||
fn main() -> Result<()> {
|
||||
let cli: Cli = Cli::parse();
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#[allow(unused_imports)]
|
||||
pub(crate) use crate::{
|
||||
builders::PyFormatterExtensions, AsFormat, FormatNodeRule, FormattedIterExt as _, IntoFormat,
|
||||
PyFormatContext, PyFormatter,
|
||||
};
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) use ruff_formatter::prelude::*;
|
||||
|
|
|
@ -546,7 +546,7 @@ impl NarrowRange<'_> {
|
|||
Some(SavedLevel { level: saved_level })
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn leave_level(&mut self, saved_state: SavedLevel) {
|
||||
self.level = saved_state.level;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ impl FormatRule<Suite, PyFormatContext<'_>> for FormatSuite {
|
|||
} else {
|
||||
first.fmt(f)?;
|
||||
|
||||
#[allow(clippy::if_same_then_else)]
|
||||
let empty_line_after_docstring = if matches!(first, SuiteChildStatement::Docstring(_))
|
||||
&& self.kind == SuiteKind::Class
|
||||
{
|
||||
|
|
|
@ -691,7 +691,6 @@ pub(crate) fn normalize_string(
|
|||
}
|
||||
|
||||
if !new_flags.is_triple_quoted() {
|
||||
#[allow(clippy::if_same_then_else)]
|
||||
if next == opposite_quote {
|
||||
// Remove the escape by ending before the backslash and starting again with the quote
|
||||
chars.next();
|
||||
|
|
|
@ -487,7 +487,7 @@ enum SuppressionComments<'a> {
|
|||
|
||||
/// Comments that all fall into the formatted range.
|
||||
Formatted {
|
||||
#[allow(unused)]
|
||||
#[expect(unused)]
|
||||
comments: &'a [SourceComment],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ impl Indexer {
|
|||
continuation_lines.push(line_start);
|
||||
|
||||
// SAFETY: Safe because of the len assertion at the top of the function.
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
{
|
||||
line_start = prev_end + TextSize::new((index + 1) as u32);
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ where
|
|||
Ok((format_type, c))
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_possible_wrap)]
|
||||
#[expect(clippy::cast_possible_wrap)]
|
||||
fn parse_quantity<T, I>(iter: &mut ParseIter<I>) -> Result<Option<CFormatQuantity>, ParsingError>
|
||||
where
|
||||
T: Into<char> + Copy,
|
||||
|
|
|
@ -103,11 +103,7 @@ impl std::fmt::Display for StrRepr<'_, '_> {
|
|||
impl UnicodeEscape<'_> {
|
||||
const REPR_RESERVED_LEN: usize = 2; // for quotes
|
||||
|
||||
#[allow(
|
||||
clippy::cast_possible_wrap,
|
||||
clippy::cast_possible_truncation,
|
||||
clippy::cast_sign_loss
|
||||
)]
|
||||
#[expect(clippy::cast_possible_wrap, clippy::cast_sign_loss)]
|
||||
pub fn repr_layout(source: &str, preferred_quote: Quote) -> EscapeLayout {
|
||||
Self::output_layout_with_checker(source, preferred_quote, |a, b| {
|
||||
Some((a as isize).checked_add(b as isize)? as usize)
|
||||
|
@ -265,11 +261,7 @@ impl<'a> AsciiEscape<'a> {
|
|||
}
|
||||
|
||||
impl AsciiEscape<'_> {
|
||||
#[allow(
|
||||
clippy::cast_possible_wrap,
|
||||
clippy::cast_possible_truncation,
|
||||
clippy::cast_sign_loss
|
||||
)]
|
||||
#[expect(clippy::cast_possible_wrap, clippy::cast_sign_loss)]
|
||||
pub fn repr_layout(source: &[u8], preferred_quote: Quote) -> EscapeLayout {
|
||||
Self::output_layout_with_checker(source, preferred_quote, 3, |a, b| {
|
||||
Some((a as isize).checked_add(b as isize)? as usize)
|
||||
|
|
|
@ -1459,7 +1459,7 @@ impl<'src> Lexer<'src> {
|
|||
|
||||
/// Retrieves the current offset of the cursor within the source code.
|
||||
// SAFETY: Lexer doesn't allow files larger than 4GB
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
#[inline]
|
||||
fn offset(&self) -> TextSize {
|
||||
TextSize::new(self.source.len() as u32) - self.cursor.text_len()
|
||||
|
|
|
@ -62,7 +62,7 @@ impl<'src> Cursor<'src> {
|
|||
///
|
||||
/// Use [`Cursor::rest`] to get the remaining text.
|
||||
// SAFETY: The `source.text_len` call in `new` would panic if the string length is larger than a `u32`.
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
pub(super) fn text_len(&self) -> TextSize {
|
||||
TextSize::new(self.chars.as_str().len() as u32)
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ pub(crate) struct TokenSourceCheckpoint {
|
|||
/// of `contents`.
|
||||
///
|
||||
/// See [#9546](https://github.com/astral-sh/ruff/pull/9546) for a more detailed explanation.
|
||||
#[allow(dead_code)]
|
||||
#[expect(dead_code)]
|
||||
fn allocate_tokens_vec(contents: &str) -> Vec<Token> {
|
||||
let lower_bound = contents.len().saturating_mul(15) / 100;
|
||||
Vec::with_capacity(lower_bound)
|
||||
|
|
|
@ -274,7 +274,7 @@ fn extract_options(source: &str) -> Option<ParseOptions> {
|
|||
// Use it for quickly debugging a parser issue.
|
||||
#[test]
|
||||
#[ignore]
|
||||
#[allow(clippy::print_stdout)]
|
||||
#[expect(clippy::print_stdout)]
|
||||
fn parser_quick_test() {
|
||||
let source = "\
|
||||
f'{'
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::implicit_imports::ImplicitImports;
|
|||
use crate::py_typed::PyTypedInfo;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[expect(clippy::struct_excessive_bools)]
|
||||
pub(crate) struct ImportResult {
|
||||
/// Whether the import name was relative (e.g., ".foo").
|
||||
pub(crate) is_relative: bool,
|
||||
|
@ -76,7 +76,7 @@ pub(crate) struct ImportResult {
|
|||
|
||||
/// If the import resolved to a type hint (i.e., a `.pyi` file), then
|
||||
/// a non-type-hint resolution will be stored here.
|
||||
#[allow(clippy::struct_field_names)]
|
||||
#[expect(clippy::struct_field_names)]
|
||||
pub(crate) non_stub_import_result: Option<Box<ImportResult>>,
|
||||
|
||||
/// Information extracted from the `py.typed` in the package used to
|
||||
|
|
|
@ -12,7 +12,7 @@ use crate::import_result::{ImportResult, ImportType};
|
|||
use crate::module_descriptor::ImportModuleDescriptor;
|
||||
use crate::{host, native_module, py_typed, search};
|
||||
|
||||
#[allow(clippy::fn_params_excessive_bools)]
|
||||
#[expect(clippy::fn_params_excessive_bools)]
|
||||
fn resolve_module_descriptor(
|
||||
root: &Path,
|
||||
module_descriptor: &ImportModuleDescriptor,
|
||||
|
@ -206,7 +206,7 @@ fn resolve_module_descriptor(
|
|||
/// defined in [PEP 420].
|
||||
///
|
||||
/// [PEP 420]: https://peps.python.org/pep-0420/
|
||||
#[allow(clippy::fn_params_excessive_bools)]
|
||||
#[expect(clippy::fn_params_excessive_bools)]
|
||||
fn resolve_absolute_import(
|
||||
root: &Path,
|
||||
module_descriptor: &ImportModuleDescriptor,
|
||||
|
|
|
@ -1147,7 +1147,7 @@ pub fn find_assigned_value<'a>(symbol: &str, semantic: &'a SemanticModel<'a>) ->
|
|||
///
|
||||
/// This function will return a `NumberLiteral` with value `Int(42)` when called with `foo` and a
|
||||
/// `StringLiteral` with value `"str"` when called with `bla`.
|
||||
#[allow(clippy::single_match)]
|
||||
#[expect(clippy::single_match)]
|
||||
pub fn find_binding_value<'a>(binding: &Binding, semantic: &'a SemanticModel) -> Option<&'a Expr> {
|
||||
match binding.kind {
|
||||
// Ex) `x := 1`
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
/// modules.
|
||||
///
|
||||
/// [builtin module]: https://docs.python.org/3/library/sys.html#sys.builtin_module_names
|
||||
#[allow(clippy::unnested_or_patterns)]
|
||||
#[expect(clippy::unnested_or_patterns)]
|
||||
pub fn is_builtin_module(minor_version: u8, module: &str) -> bool {
|
||||
matches!(
|
||||
(minor_version, module),
|
||||
|
|
|
@ -30,7 +30,7 @@ pub fn find_only_token_in_range(
|
|||
let token = tokens.next().expect("Expected a token");
|
||||
debug_assert_eq!(token.kind(), token_kind);
|
||||
let mut tokens = tokens.skip_while(|token| token.kind == SimpleTokenKind::LParen);
|
||||
#[allow(clippy::debug_assert_with_mut_call)]
|
||||
#[expect(clippy::debug_assert_with_mut_call)]
|
||||
{
|
||||
debug_assert_eq!(tokens.next(), None);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ pub fn lines_after_ignoring_trivia(offset: TextSize, code: &str) -> u32 {
|
|||
|
||||
/// Counts the empty lines after `offset`, ignoring any trailing trivia on the same line as
|
||||
/// `offset`.
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
pub fn lines_after_ignoring_end_of_line_trivia(offset: TextSize, code: &str) -> u32 {
|
||||
// SAFETY: We don't support files greater than 4GB, so casting to u32 is safe.
|
||||
SimpleTokenizer::starts_at(offset, code)
|
||||
|
|
|
@ -247,7 +247,7 @@ mod tests {
|
|||
use super::NotebookDocument;
|
||||
|
||||
enum TestCellContent {
|
||||
#[allow(dead_code)]
|
||||
#[expect(dead_code)]
|
||||
Markup(String),
|
||||
Code(String),
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ pub(crate) fn init_logging(log_level: LogLevel, log_file: Option<&std::path::Pat
|
|||
.append(true)
|
||||
.open(&path)
|
||||
.map_err(|err| {
|
||||
#[allow(clippy::print_stderr)]
|
||||
#[expect(clippy::print_stderr)]
|
||||
{
|
||||
eprintln!(
|
||||
"Failed to open file at {} for logging: {err}",
|
||||
|
|
|
@ -5,7 +5,7 @@ use lsp_types as types;
|
|||
use lsp_types::InitializeParams;
|
||||
use std::num::NonZeroUsize;
|
||||
// The new PanicInfoHook name requires MSRV >= 1.82
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
use std::panic::PanicInfo;
|
||||
use std::str::FromStr;
|
||||
use types::ClientCapabilities;
|
||||
|
@ -116,7 +116,7 @@ impl Server {
|
|||
|
||||
pub fn run(self) -> crate::Result<()> {
|
||||
// The new PanicInfoHook name requires MSRV >= 1.82
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
type PanicHook = Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>;
|
||||
struct RestorePanicHook {
|
||||
hook: Option<PanicHook>,
|
||||
|
@ -170,7 +170,6 @@ impl Server {
|
|||
.join()
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)] // this is because we aren't using `next_request_id` yet.
|
||||
fn event_loop(
|
||||
connection: &Connection,
|
||||
client_capabilities: &ClientCapabilities,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue