Comments (5)
I would like to work on this. Can you please elaborate more about this issue ?
from rust-clippy.
So here we need to check for situations where we are casting before comparing, i.e. x as u32 > 200
or x as u32 < 0
, and the original type has a range such that the comparison will always be true or always be false.
...actually, this isn't really an easy bug since you have to look up the value of x
and ensure its not getting written to.
from rust-clippy.
#97 should be easier. Its a simple check_ty with most of the details explained in the last comment. There are some complications there but I'll explain how to handle them when we reach that stage.
from rust-clippy.
I don't think so. It should suffice matching a comparison where one of the operands is an ExprCast whose inner expression has a primitive type that is smaller than the comapred value (via expr_ty)
from rust-clippy.
Ah, I misunderstood the issue. In that case this isn't too hard.
from rust-clippy.
Related Issues (20)
- items_after_statements shouldn't fire when const has no name HOT 1
- Warn when calling `is_empty` on non-empty value HOT 1
- Suggest replacing str::split with empty pattern with str::chars
- Remove unnecessary type from a typed literal HOT 1
- arithmetic_side_effects not triggered when `add_assign` used HOT 1
- FP `deref_addrof` HOT 4
- `must_use_unit` fails to apply if it's one of many attrs
- [Pattern_type_mismatch] clippy encouraging to dereference, but not needed.
- `unnecessary_to_owned` false positive when iterating over `Copy` types.
- ICE in `NEEDLESS_RETURN` when building lint span HOT 2
- redundant_pattern_matching failes to check whether contained value are used.
- `must_use_candidate` has faulty checking for side-effects HOT 1
- manual_swap lint suggestion doesnt compile HOT 3
- Redundant imports from `std` prelude in maybe-no_std crate HOT 2
- `?` error propagation lint breaks with try-blocks HOT 2
- Incorrect infinite loop detection in async functions HOT 2
- Unneeded casts in a comparison HOT 2
- GitHub Corner colors don't sync with the rest of the page HOT 1
- ICE: `with expression doesn't evaluate to a struct`
- ICE: `None` in `cast_possible_truncation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-clippy.