meta: Set clippy lints in {main,lib}.rs

So that this does not have to be manually passed to the `cargo clippy`
command-line every single time. Also allows incrementally addressing
these lints by removing and fixing them one-by-one.
This commit is contained in:
David Mak 2024-06-12 12:27:35 +08:00
parent c4420e6ab9
commit 40a3bded36
9 changed files with 114 additions and 9 deletions

View File

@ -1,3 +1,15 @@
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::enum_glob_use,
clippy::similar_names,
clippy::too_many_lines,
clippy::wildcard_imports
)]
use std::collections::{HashMap, HashSet};
use std::fs;
use std::io::Write;

View File

@ -1,3 +1,18 @@
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
clippy::cast_lossless,
clippy::default_trait_access,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::must_use_candidate,
clippy::needless_pass_by_value,
clippy::too_many_lines,
clippy::uninlined_format_args,
clippy::wildcard_imports
)]
#[macro_use]
extern crate lazy_static;

View File

@ -2367,7 +2367,7 @@ pub fn gen_expr<'ctx, G: CodeGenerator>(
))
}
Some(v) => Ok(Some(v)),
}
};
}
ValueEnum::Dynamic(BasicValueEnum::PointerValue(ptr)) => {
let not_null =

View File

@ -1270,7 +1270,7 @@ pub fn gen_try<'ctx, 'a, G: CodeGenerator>(
// run end_catch before continue/break/return
let mut final_proxy_lambda =
|ctx: &mut CodeGenContext<'ctx, 'a>, target: BasicBlock<'ctx>, block: BasicBlock<'ctx>| {
final_proxy(ctx, target, block, final_data.as_mut().unwrap())
final_proxy(ctx, target, block, final_data.as_mut().unwrap());
};
let mut redirect_lambda =
|ctx: &mut CodeGenContext<'ctx, 'a>, target: BasicBlock<'ctx>, block: BasicBlock<'ctx>| {

View File

@ -1,5 +1,19 @@
#![warn(clippy::all)]
#![allow(dead_code)]
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
dead_code,
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
clippy::enum_glob_use,
clippy::implicit_hasher,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::similar_names,
clippy::too_many_lines,
clippy::wildcard_imports
)]
pub mod codegen;
pub mod symbol_resolver;

View File

@ -1,3 +1,38 @@
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
clippy::borrow_as_ptr,
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_ptr_alignment,
clippy::cast_sign_loss,
clippy::doc_markdown,
clippy::enum_glob_use,
clippy::explicit_iter_loop,
clippy::expl_impl_clone_on_copy,
clippy::items_after_statements,
clippy::manual_let_else,
clippy::match_same_arms,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::needless_pass_by_value,
clippy::ptr_as_ptr,
clippy::redundant_closure_call,
clippy::result_unit_err,
clippy::semicolon_if_nothing_returned,
clippy::similar_names,
clippy::stable_sort_primitive,
clippy::struct_field_names,
clippy::too_many_lines,
clippy::type_complexity,
clippy::unnecessary_wraps,
clippy::unnested_or_patterns,
clippy::unreadable_literal,
clippy::wildcard_imports
)]
use dwarf::*;
use elf::*;
use std::collections::HashMap;

View File

@ -15,6 +15,30 @@
//!
//! ```
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
clippy::default_trait_access,
clippy::doc_markdown,
clippy::enum_glob_use,
clippy::fn_params_excessive_bools,
clippy::if_not_else,
clippy::implicit_clone,
clippy::match_same_arms,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::must_use_candidate,
clippy::redundant_closure_for_method_calls,
clippy::semicolon_if_nothing_returned,
clippy::single_match_else,
clippy::too_many_lines,
clippy::uninlined_format_args,
clippy::unnested_or_patterns,
clippy::unused_self,
clippy::wildcard_imports
)]
#[macro_use]
extern crate log;
use lalrpop_util::lalrpop_mod;
@ -27,7 +51,7 @@ pub mod lexer;
pub mod mode;
pub mod parser;
lalrpop_mod!(
#[allow(clippy::all)]
#[allow(clippy::all, clippy::pedantic)]
#[allow(unused)]
python
);

View File

@ -1,3 +1,7 @@
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::cast_possible_truncation, clippy::too_many_lines, clippy::wildcard_imports)]
use clap::Parser;
use inkwell::{
memory_buffer::MemoryBuffer, passes::PassBuilderOptions, support::is_multithreaded, targets::*,
@ -310,10 +314,7 @@ fn main() {
StmtKind::ImportFrom { module, names, .. }
if module == &Some("__future__".into())
&& names.len() == 1
&& names[0].name == "annotations".into() =>
{
()
}
&& names[0].name == "annotations".into() => {}
_ => {
let (name, def_id, ty) = composer
.register_top_level(stmt, Some(resolver.clone()), "__main__", true)

View File

@ -1,3 +1,7 @@
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::semicolon_if_nothing_returned, clippy::uninlined_format_args)]
use std::env;
static mut NOW: i64 = 0;