Skip to content

parameter only used in recursion false positive #8629

Closed
@hellow554

Description

@hellow554

Summary

The lint triggers even when there's no recursion and it is "used"

Lint Name

only_used_in_recursion

Reproducer

I tried this code:

pub fn k(num_chunks: u64)
{
    let num_bytes = 98989;
    let _chunk_size = num_bytes * num_chunks;
}

I saw this happen:

warning: parameter is only used in recursion
 --> src/main.rs:1:10
  |
1 | pub fn k(num_chunks: u64)
  |          ^^^^^^^^^^ help: if this is intentional, prefix with an underscore: `_num_chunks`
  |
  = note: `#[warn(clippy::only_used_in_recursion)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#only_used_in_recursion

Version

rustc 1.61.0-nightly (6af09d250 2022-04-03)
binary: rustc
commit-hash: 6af09d2505f38e4f1df291df56d497fb2ad935ed
commit-date: 2022-04-03
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions