Skip to content

redundant_locals incorrectly emitted when binding in new local scope for early drop #13227

Open
@SUPERCILEX

Description

Summary

let (result_stream, threads) = {
    let query = query; // ERROR
    ringboard_sdk::search(
        if regex {
            Query::Regex(Regex::new(&query)?)
        } else if ignore_case {
            Query::PlainIgnoreCase(CaselessQuery::new(query).trim())
        } else {
            Query::Plain(query.as_bytes())
        },
        reader.clone(),
    )
};

I'm rebinding an outside scope variable to get it to drop after starting the search.

Lint Name

redundant_locals

Reproducer

No response

Version

rustc 1.82.0-nightly (64ebd39da 2024-08-03)
binary: rustc
commit-hash: 64ebd39da5ec28caa3bd7cbb3f22f5949432fe2b
commit-date: 2024-08-03
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Additional Labels

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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