Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8881 -- condition! imports parent's pub identifiers #8963

Closed
wants to merge 1 commit into from
Closed

Fixes #8881 -- condition! imports parent's pub identifiers #8963

wants to merge 1 commit into from

Conversation

jmgrosen
Copy link
Contributor

@jmgrosen jmgrosen commented Sep 3, 2013

No description provided.

@bors bors closed this Sep 4, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 17, 2024
`significant_drop_in_scrutinee`: Fix false positives due to false drops of place expressions

Place expressions do not really create temporaries, so they will not create significant drops. For example, the following code snippet is quite good (rust-lang#8963):
```rust
fn main() {
    let x = std::sync::Mutex::new(vec![1, 2, 3]);
    let x_guard = x.lock().unwrap();
    match x_guard[0] {
        1 => println!("1!"),
        x => println!("{x}"),
    }
    drop(x_guard); // Some "usage"
}
```

Also, the previous logic thinks that references like `&MutexGuard<_>`/`Ref<'_, MutexGuard<'_, _>>` have significant drops, which is simply not true, so it is fixed together in this PR.

Fixes rust-lang/rust-clippy#8963
Fixes rust-lang/rust-clippy#9072

changelog: [`significant_drop_in_scrutinee`]: Fix false positives due to false drops of place expressions.

r? `@blyxyas`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants