Comments (4)
This would be simple enough for int and perhaps float values. The main problem is how to find out if a literal is greater or lower than another. We'd need a generic cmp_lit method, which means I'll need to learn a bit more about literals.
from rust-clippy.
Actually, using const folding, this is now rather easy.
from rust-clippy.
(Example of const folding is https://github.com/Manishearth/rust-clippy/blob/master/src/identity_op.rs#L47)
from rust-clippy.
I should add that Constant
s now implement PartialOrd
, so they can meaningfully be compared using normal comparison operators (like >
or <=
).
from rust-clippy.
Related Issues (20)
- False positivie (I think): blocks_in_conditions HOT 3
- `clippy::manual_unwrap_or_default` triggers on macro generated code
- `map_flatten` could suggest `filter(matches!())` in case of `map( match { _ => Option }).flatten()` HOT 2
- manual_flatten ignores nested refutable pattern HOT 1
- Clippy is no longer available via crates.io HOT 2
- compilation failure after applying lint `filter_map_identity` HOT 1
- default_constructed_unit_structs sugg causes error
- Unifying an invariant lifetime with a covariant one is almost always bad
- --no-deps doesn't ignore path based deps
- manual_map sugg with dyn causes error HOT 1
- New lint to ensure `Default::default` calls `T::new`, rather than vice versa. HOT 1
- clippy suggests to use retain in the same way as filter HOT 2
- manual_async_fn suggestions breaks code if !Send types involved
- `manual_unwrap_or_default` fails to consider deref type coercion HOT 3
- `--fix` with `-Zthreads=8` on large workspace hangs HOT 1
- Can we not get attribute from other crate? HOT 2
- `manual_unwrap_or_default` suggested fix fails to compile due to missing type annotation
- `let_unit_value` and `no_effect` trigger for static assertions HOT 2
- Paths printed with {:?} instead of .display() HOT 2
- Unit-like structs should not trigger `exhaustive_structs` HOT 2
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.