iter clippy-sweep: clear all 61 cargo clippy warnings
Hygiene sweep across the workspace under `cargo clippy --workspace
--all-targets`. Before: 61 warnings. After: zero. Tests stay 563
green, `cargo doc` stays at zero warnings, and all three bench
scripts exit 0 against existing baselines.
Twelve lint classes, three fix shapes:
- Documentation hygiene (~32 hits): `doc_lazy_continuation` resolved
by adding blank lines before continuation paragraphs or rephrasing
the offending line; plus four `empty_line_after_doc_comments` hits
in workspace.rs where eight `///` blocks left orphan by form-a.1
T5 test relocation were converted to plain `//`.
- Idiomatic refactors (~16 hits): `.err().expect()` → `.expect_err()`,
redundant `.into_iter()` and `.into()` removed, `|f| g(f)` →
`g`, `.trim().split_whitespace()` → `.split_whitespace()`,
`push_str("x")` → `push('x')`, two manual `impl Default` flipped
to `#[derive(Default)]` + `#[default]`, two nested `if let Some(_)
= …` collapsed.
- Block extraction (1 hit): a 13-line block inside an `else if`
condition in synth's Var-arm extracted to a new helper
`is_class_method_dispatch(name, env)` next to
`qualifier_is_class_shape`.
Three `#[allow]`s with inline rationale where clippy's suggestion
would lose meaning: `only_used_in_recursion` on walk_pattern (the
parameter preserves the five-fn walker-framework signature
uniformity), 2× `if_same_then_else` on qualify_local_types shapes
(two branches encode semantically distinct disqualification
reasons), `too_many_arguments` on `Emitter::new` (8 workspace-flat
tables; bundling would just rename boilerplate).
This commit is contained in:
@@ -532,26 +532,24 @@ impl<'a> Emitter<'a> {
|
||||
// var on an as-yet-unmonomorphised polymorphic call —
|
||||
// the monomorphised copies will resolve correctly).
|
||||
Term::App { .. } => {
|
||||
if let Ok(ret_ty) = self.synth_arg_type(value) {
|
||||
if let Type::Con { name, .. } = ret_ty {
|
||||
// Symmetric to `field_drop_call`'s Str arm: Str is a
|
||||
// built-in pointer type with no per-type drop fn. Both
|
||||
// heap-Str (rc_header at payload-8) and static-Str
|
||||
// (codegen-elision keeps static pointers out of this
|
||||
// path) consume via `ailang_rc_dec`.
|
||||
if name == "Str" {
|
||||
return "ailang_rc_dec".to_string();
|
||||
}
|
||||
if name.matches('.').count() == 1 {
|
||||
let (prefix, suffix) =
|
||||
name.split_once('.').expect("checked");
|
||||
if let Some(target) = self.import_map.get(prefix) {
|
||||
return format!("drop_{target}_{suffix}");
|
||||
}
|
||||
return format!("drop_{prefix}_{suffix}");
|
||||
}
|
||||
return format!("drop_{m}_{name}", m = self.module_name);
|
||||
if let Ok(Type::Con { name, .. }) = self.synth_arg_type(value) {
|
||||
// Symmetric to `field_drop_call`'s Str arm: Str is a
|
||||
// built-in pointer type with no per-type drop fn. Both
|
||||
// heap-Str (rc_header at payload-8) and static-Str
|
||||
// (codegen-elision keeps static pointers out of this
|
||||
// path) consume via `ailang_rc_dec`.
|
||||
if name == "Str" {
|
||||
return "ailang_rc_dec".to_string();
|
||||
}
|
||||
if name.matches('.').count() == 1 {
|
||||
let (prefix, suffix) =
|
||||
name.split_once('.').expect("checked");
|
||||
if let Some(target) = self.import_map.get(prefix) {
|
||||
return format!("drop_{target}_{suffix}");
|
||||
}
|
||||
return format!("drop_{prefix}_{suffix}");
|
||||
}
|
||||
return format!("drop_{m}_{name}", m = self.module_name);
|
||||
}
|
||||
"ailang_rc_dec".to_string()
|
||||
}
|
||||
@@ -578,6 +576,7 @@ impl<'a> Emitter<'a> {
|
||||
/// match that moved out some fields;
|
||||
/// 3. [`Self::emit_inlined_partial_drop`]'s non-Ctor branch
|
||||
/// (let-binder whose value is `Term::App`).
|
||||
///
|
||||
/// All three share the same shape: a binder whose runtime ctor
|
||||
/// tag is dynamic (not statically known from a `Term::Ctor`)
|
||||
/// and whose `moved_slots` is a strict subset of its ptr fields.
|
||||
|
||||
@@ -154,19 +154,14 @@ type Result<T> = std::result::Result<T, CodegenError>;
|
||||
/// Iter 18c once uniqueness inference is wired up.
|
||||
/// The IR is otherwise byte-identical between the three strategies
|
||||
/// modulo the allocator symbol name.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum AllocStrategy {
|
||||
#[default]
|
||||
Gc,
|
||||
Bump,
|
||||
Rc,
|
||||
}
|
||||
|
||||
impl Default for AllocStrategy {
|
||||
fn default() -> Self {
|
||||
AllocStrategy::Gc
|
||||
}
|
||||
}
|
||||
|
||||
impl AllocStrategy {
|
||||
/// LLVM IR-level name of the allocator fn (without leading `@`).
|
||||
fn fn_name(self) -> &'static str {
|
||||
@@ -759,6 +754,11 @@ struct FnSig {
|
||||
}
|
||||
|
||||
impl<'a> Emitter<'a> {
|
||||
// The eight parameters are all the workspace-flat tables the
|
||||
// emitter needs at construction time; bundling them into a
|
||||
// context struct would just rename the boilerplate without
|
||||
// reducing it. Keep the explicit-arg shape.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn new(
|
||||
module: &'a Module,
|
||||
module_name: &'a str,
|
||||
|
||||
@@ -163,6 +163,11 @@ pub(crate) fn qualify_local_types_codegen(
|
||||
) -> Type {
|
||||
match t {
|
||||
Type::Con { name, args } => {
|
||||
// The first two branches share the body `name.clone()` but
|
||||
// express semantically distinct reasons (already qualified;
|
||||
// primitive needs no qualification). Combining them with
|
||||
// `||` would obscure why each disqualifies the name.
|
||||
#[allow(clippy::if_same_then_else)]
|
||||
let qualified = if name.contains('.') {
|
||||
name.clone()
|
||||
} else if ailang_core::primitives::is_primitive_name(name) {
|
||||
|
||||
Reference in New Issue
Block a user