Skip to content

Work around an eager clippy warning #154

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

Merged
merged 1 commit into from
Mar 19, 2022
Merged

Work around an eager clippy warning #154

merged 1 commit into from
Mar 19, 2022

Conversation

lqd
Copy link
Contributor

@lqd lqd commented Mar 15, 2022

As seen in #152 (comment) and #153 (comment), it seems a recent nightly has introduced a false positive in the needless_match lint, causing CI to fail as it denies warnings.

Just for reference, it looks side-effects in branches are missed, and thought to be replaceable by the matched Option.

pub fn side_effect() -> Option<String> {
    if let Some(r) = op() {
        Some(r)
    } else {
        println!("side-effect");
        None
    }
}

We could ignore the lint, much like other lints are sometimes ignored, or work around it like this PR. Which do you prefer ?

@netlify
Copy link

netlify bot commented Mar 15, 2022

✔️ Deploy Preview for dada-lang ready!

🔨 Explore the source changes: f3c6134

🔍 Inspect the deploy log: https://app.netlify.com/sites/dada-lang/deploys/6230b3bd8514e70008df2c27

😎 Browse the preview: https://deploy-preview-154--dada-lang.netlify.app

@nikomatsakis
Copy link
Member

This looks good.

bors r+

bors bot added a commit that referenced this pull request Mar 16, 2022
154: Work around an eager clippy warning r=nikomatsakis a=lqd

As seen in #152 (comment) and #153 (comment), it seems a recent nightly has introduced a false positive in the `needless_match` lint, causing CI to fail as it denies warnings.

Just for reference, it looks side-effects in branches are missed, and thought to be replaceable by the matched Option.

```rust
pub fn side_effect() -> Option<String> {
    if let Some(r) = op() {
        Some(r)
    } else {
        println!("side-effect");
        None
    }
}
```

We could ignore the lint, much like other lints are sometimes ignored, or work around it like this PR. Which do you prefer ?

Co-authored-by: Rémy Rakic <[email protected]>
@bors
Copy link
Contributor

bors bot commented Mar 16, 2022

Build failed:

@lqd
Copy link
Contributor Author

lqd commented Mar 16, 2022

That's quite a streak we got there, now an ICE on nightly, hitting issue 94998

thread 'rustc' panicked at 'assertion failed: !value.has_escaping_bound_vars()', /rustc/52b34550aca5f7dd7e152f773e3ab786acb86f6f/compiler/rustc_middle/src/ty/sty.rs:1089:9
query stack during panic:
#0 [is_sized_raw] computing whether `dyn std::io::Write` is `Sized`
#1 [layout_of] computing layout of `*const dyn std::io::Write`
#2 [layout_of] computing layout of `core::ptr::unique::Unique<dyn std::io::Write>`
#3 [layout_of] computing layout of `alloc::boxed::Box<dyn std::io::Write>`

@lqd
Copy link
Contributor Author

lqd commented Mar 18, 2022

This will be fixed in tomorrow's nightly

@nikomatsakis
Copy link
Member

ok :)

@nikomatsakis
Copy link
Member

bors r+

let's try again in case we're lucky

bors bot added a commit that referenced this pull request Mar 18, 2022
154: Work around an eager clippy warning r=nikomatsakis a=lqd

As seen in #152 (comment) and #153 (comment), it seems a recent nightly has introduced a false positive in the `needless_match` lint, causing CI to fail as it denies warnings.

Just for reference, it looks side-effects in branches are missed, and thought to be replaceable by the matched Option.

```rust
pub fn side_effect() -> Option<String> {
    if let Some(r) = op() {
        Some(r)
    } else {
        println!("side-effect");
        None
    }
}
```

We could ignore the lint, much like other lints are sometimes ignored, or work around it like this PR. Which do you prefer ?

Co-authored-by: Rémy Rakic <[email protected]>
@bors
Copy link
Contributor

bors bot commented Mar 18, 2022

Build failed:

@lqd
Copy link
Contributor Author

lqd commented Mar 18, 2022

Issues with GH and CI prevented the fix from landing yesterday. This will still fail for at least another few hours. Thankfully, the fix has landed by now.

@nikomatsakis
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 19, 2022

Build succeeded:

@bors bors bot merged commit 6347abb into dada-lang:main Mar 19, 2022
@lqd lqd deleted the clippy branch March 19, 2022 09:16
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