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

Support ANSI colors in msys terminals. See #2807 #11028

Closed
wants to merge 1 commit into from

Conversation

jhasse
Copy link
Contributor

@jhasse jhasse commented Dec 17, 2013

Enable ANSI colors if TERM is set to cygwin and terminfo is not available (msys terminal on Windows).

@jhasse
Copy link
Contributor Author

jhasse commented Dec 17, 2013

#2807

return Err(~"TERM environment variable undefined");
}
let term = match os::getenv("TERM") {
None => return Err(~"TERM environment variable undefined"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: reorder these arms (None/error handling should come last)

@jhasse
Copy link
Contributor Author

jhasse commented Dec 17, 2013

Thanks for the suggestions, new pull request: #11031

@jhasse jhasse closed this Dec 17, 2013
@jhasse jhasse deleted the patch-msys-2 branch December 17, 2013 16:40
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 2, 2023
…r=llogiq

Skip if_not_else lint for '!= 0'-style checks

Currently, clippy makes unhelpful suggestions such as this:

```
warning: unnecessary `!=` operation
   --> src/vm.rs:598:36
    |
598 |                     *destination = if source & 0x8000 != 0 { 0xFFFF } else { 0 };
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: change to `==` and swap the blocks of the `if`/`else`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
    = note: `-W clippy::if-not-else` implied by `-W clippy::pedantic`
```

Bit tests often take on the form `if foo & 0x1234 != 0 { … } else { … }`, and the `!= 0` part reads as "has any bits set". Therefore, this code already has the "correct" order, and shouldn't be changed.

This PR disables the lint for these cases, and in fact all cases where the condition is "foo is non-zero".

I did my homework:
- \[X] Followed [lint naming conventions][lint_naming] → Not applicable, this PR fixes an existing lint
- \[X] Added passing UI tests (including committed `.stderr` file) → Yes, `tests/ui/if_not_else_bittest.rs`
- \[X] `cargo test` passes locally
- \[X] Executed `cargo dev update_lints`
- \[X] Added lint documentation → Not applicable, this PR fixes an existing lint
- \[X] Run `cargo dev fmt`

changelog: Fix [`if_not_else`] false positive when something like `bitflags != 0` is used
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.

3 participants