Skip to contentSkip to conversation

drm/panic: clean Clippy warning

PATCH Applied Miguel Ojeda 3 participants 4 messages Mar 3, 2025 – Mar 10, 2025

Subsystems (3)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 drm/panic: clean Clippy warning

Clippy warns:

    error: manual implementation of an assign operation
       --> drivers/gpu/drm/drm_panic_qr.rs:418:25
        |
    418 |                         self.carry = self.carry % pow;
        |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.carry %= pow`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

Thus clean it up.

Fixes dbed4a797e00 ("drm/panic: Better binary encoding in QR code")
---
 drivers/gpu/drm/drm_panic_qr.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_panic_qr.rs +1 -1
index 62cb8a162483..3b0dd59781d4 100644
@@ -415,7 +415,7 @@ fn next(&mut self) -> Option<Self::Item> {
                         self.carry_len -= out_len;
                         let pow = u64::pow(10, self.carry_len as u32);
                         let out = (self.carry / pow) as u16;
-                        self.carry = self.carry % pow;
+                        self.carry %= pow;
                         Some((out, NUM_CHARS_BITS[out_len]))
                     }
                 }

base-commit: c0eb65494e59d9834af7cbad983629e9017b25a1

Signature · 1 line
2.48.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Miguel Ojeda

Clippy warns:

    error: manual implementation of an assign operation
       --> drivers/gpu/drm/drm_panic_qr.rs:418:25
        |
    418 |                         self.carry = self.carry % pow;
        |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.carry %= pow`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
Quoted 4 lines

Thus clean it up.

Fixes dbed4a797e00 ("drm/panic: Better binary encoding in QR code")
Reviewed-by on v1 1/1
#2 lore raw
In reply to Miguel Ojeda
Quoted 11 lines · Miguel Ojeda

Clippy warns:

     error: manual implementation of an assign operation
        --> drivers/gpu/drm/drm_panic_qr.rs:418:25
         |
     418 |                         self.carry = self.carry % pow;
         |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.carry %= pow`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

Thus clean it up.

Thanks, it looks good to me.

Quoted 22 lines
Fixes dbed4a797e00 ("drm/panic: Better binary encoding in QR code")
---
  drivers/gpu/drm/drm_panic_qr.rs | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_panic_qr.rs +1 -1
index 62cb8a162483..3b0dd59781d4 100644
@@ -415,7 +415,7 @@ fn next(&mut self) -> Option<Self::Item> {
                          self.carry_len -= out_len;
                          let pow = u64::pow(10, self.carry_len as u32);
                          let out = (self.carry / pow) as u16;
-                        self.carry = self.carry % pow;
+                        self.carry %= pow;
                          Some((out, NUM_CHARS_BITS[out_len]))
                      }
                  }

base-commit: c0eb65494e59d9834af7cbad983629e9017b25a1

#3 lore raw
In reply to Miguel Ojeda
Quoted 11 lines · Miguel Ojeda

Clippy warns:

     error: manual implementation of an assign operation
        --> drivers/gpu/drm/drm_panic_qr.rs:418:25
         |
     418 |                         self.carry = self.carry % pow;
         |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.carry %= pow`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

Thus clean it up.

Applied to drm-misc-next (because dbed4a797e00 is only present in this branch).

Thanks for your contribution.

Signature · 1 line
Jocelyn
Quoted 22 lines
Fixes dbed4a797e00 ("drm/panic: Better binary encoding in QR code")
---
  drivers/gpu/drm/drm_panic_qr.rs | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_panic_qr.rs +1 -1
index 62cb8a162483..3b0dd59781d4 100644
@@ -415,7 +415,7 @@ fn next(&mut self) -> Option<Self::Item> {
                          self.carry_len -= out_len;
                          let pow = u64::pow(10, self.carry_len as u32);
                          let out = (self.carry / pow) as u16;
-                        self.carry = self.carry % pow;
+                        self.carry %= pow;
                          Some((out, NUM_CHARS_BITS[out_len]))
                      }
                  }

base-commit: c0eb65494e59d9834af7cbad983629e9017b25a1