urlyy commented on code in PR #2914:
URL: https://github.com/apache/fory/pull/2914#discussion_r2529708487


##########
rust/fory-core/src/buffer.rs:
##########
@@ -179,7 +179,7 @@ impl<'a> Writer<'a> {
 
     #[inline(always)]
     pub fn write_sliint64(&mut self, value: i64) {
-        if value >= HALF_MIN_INT && value <= HALF_MAX_INT {
+        if (HALF_MIN_INT..=HALF_MAX_INT).contains(&value) {

Review Comment:
   This is the lint error and hint I got:
   ```shell
   $ cargo clippy --all-targets --all-features -- -D warnings
   
   error: manual `RangeInclusive::contains` implementation                      
                                                                                
                                                                      
      --> fory-core\src\buffer.rs:182:12
       |
   182 |         if value >= HALF_MIN_INT && value <= HALF_MAX_INT {
       |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: 
`(HALF_MIN_INT..=HALF_MAX_INT).contains(&value)`
       |
       = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
       = note: `-D clippy::manual-range-contains` implied by `-D warnings`
       = help: to override `-D warnings` add 
`#[allow(clippy::manual_range_contains)]`
   ```
   
   You can see detail at 
`https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains`.
   
   Maybe more Rust-idiomatic, but actually, I think the condition is still more 
intuitive.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to