about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-10-07 11:10:55 -0700
committerGitHub <noreply@github.com>2024-10-07 11:10:55 -0700
commit3f88d6a83a63c8dc5f23ddeb447bb6f43effa264 (patch)
tree00b67bc0b3a13da016090bebd380bac681694599
parentf88bfa34e1c64758b6e3b37014282c929caecccb (diff)
parent4085b48dfddd742fa4d46c594ee5662b972ae6de (diff)
downloadrust-3f88d6a83a63c8dc5f23ddeb447bb6f43effa264.tar.gz
rust-3f88d6a83a63c8dc5f23ddeb447bb6f43effa264.zip
Rollup merge of #131359 - practicalrs:fix_used_underscore_binding, r=jieyouxu
Fix used_underscore_binding in rustc_serialize

Hi,

This PR fixes the following clippy warnings in rustc_serialize

```
warning: used underscore-prefixed binding
   --> compiler/rustc_serialize/src/opaque.rs:443:27
    |
443 |         debug_assert_eq!((_end_pos - _start_pos), IntEncodedWithFixedSize::ENCODED_SIZE);
    |                           ^^^^^^^^
    |
note: binding is defined here
   --> compiler/rustc_serialize/src/opaque.rs:442:13
    |
442 |         let _end_pos = e.position();
    |             ^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_binding
    = note: requested on the command line with `-W clippy::used-underscore-binding`

warning: used underscore-prefixed binding
   --> compiler/rustc_serialize/src/opaque.rs:443:38
    |
443 |         debug_assert_eq!((_end_pos - _start_pos), IntEncodedWithFixedSize::ENCODED_SIZE);
    |                                      ^^^^^^^^^^
    |
note: binding is defined here
   --> compiler/rustc_serialize/src/opaque.rs:440:13
    |
440 |         let _start_pos = e.position();
    |             ^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_binding
```

Best regards,
Michal
-rw-r--r--compiler/rustc_serialize/src/opaque.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs
index c7c561156e3..27e9f817894 100644
--- a/compiler/rustc_serialize/src/opaque.rs
+++ b/compiler/rustc_serialize/src/opaque.rs
@@ -437,10 +437,10 @@ impl IntEncodedWithFixedSize {
 impl Encodable<FileEncoder> for IntEncodedWithFixedSize {
     #[inline]
     fn encode(&self, e: &mut FileEncoder) {
-        let _start_pos = e.position();
+        let start_pos = e.position();
         e.write_array(self.0.to_le_bytes());
-        let _end_pos = e.position();
-        debug_assert_eq!((_end_pos - _start_pos), IntEncodedWithFixedSize::ENCODED_SIZE);
+        let end_pos = e.position();
+        debug_assert_eq!((end_pos - start_pos), IntEncodedWithFixedSize::ENCODED_SIZE);
     }
 }