Skip to content

sapemu: Extract sbc logic into separate function #700

sapemu: Extract sbc logic into separate function

sapemu: Extract sbc logic into separate function #700

GitHub Actions / clippy failed Sep 18, 2024 in 0s

clippy

10 errors

Details

Results

Message level Amount
Internal compiler error 0
Error 10
Warning 0
Note 0
Help 0

Versions

  • rustc 1.83.0-nightly (8d6b88b16 2024-09-11)
  • cargo 1.83.0-nightly (c1fa840a8 2024-08-29)
  • clippy 0.1.82 (8d6b88b 2024-09-11)

Annotations

Check failure on line 480 in sapemu/src/smp.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casts from `bool` to `u8` can be expressed infallibly using `From`

error: casts from `bool` to `u8` can be expressed infallibly using `From`
   --> sapemu/src/smp.rs:480:60
    |
480 |         let half_carry_result = (op1 & 0x0f) + ((!op2) & 0x0f) + self.carry() as u8 >= 0x10;
    |                                                                  ^^^^^^^^^^^^^^^^^^
    |
    = help: an `as` cast can become silently lossy if the types change in the future
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
help: use `u8::from` instead
    |
480 |         let half_carry_result = (op1 & 0x0f) + ((!op2) & 0x0f) + u8::from(self.carry()) >= 0x10;
    |                                                                  ~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 474 in sapemu/src/smp.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casts from `bool` to `u16` can be expressed infallibly using `From`

error: casts from `bool` to `u16` can be expressed infallibly using `From`
   --> sapemu/src/smp.rs:474:68
    |
474 |         let expanded_result = (op1 as u16).wrapping_add((!op2) as u16) + self.carry() as u16;
    |                                                                          ^^^^^^^^^^^^^^^^^^^
    |
    = help: an `as` cast can become silently lossy if the types change in the future
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
help: use `u16::from` instead
    |
474 |         let expanded_result = (op1 as u16).wrapping_add((!op2) as u16) + u16::from(self.carry());
    |                                                                          ~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 474 in sapemu/src/smp.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casts from `u8` to `u16` can be expressed infallibly using `From`

error: casts from `u8` to `u16` can be expressed infallibly using `From`
   --> sapemu/src/smp.rs:474:51
    |
474 |         let expanded_result = (op1 as u16).wrapping_add((!op2) as u16) + self.carry() as u16;
    |                                                         ^^^^^^^^^^^^^
    |
    = help: an `as` cast can become silently lossy if the types change in the future
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
help: use `u16::from` instead
    |
474 |         let expanded_result = (op1 as u16).wrapping_add(u16::from((!op2))) + self.carry() as u16;
    |                                                         ~~~~~~~~~~~~~~~~~

Check failure on line 474 in sapemu/src/smp.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casts from `u8` to `u16` can be expressed infallibly using `From`

error: casts from `u8` to `u16` can be expressed infallibly using `From`
   --> sapemu/src/smp.rs:474:25
    |
474 |         let expanded_result = (op1 as u16).wrapping_add((!op2) as u16) + self.carry() as u16;
    |                               ^^^^^^^^^^^^
    |
    = help: an `as` cast can become silently lossy if the types change in the future
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
help: use `u16::from` instead
    |
474 |         let expanded_result = u16::from(op1).wrapping_add((!op2) as u16) + self.carry() as u16;
    |                               ~~~~~~~~~~~~~~

Check failure on line 462 in sapemu/src/smp.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casts from `bool` to `u8` can be expressed infallibly using `From`

error: casts from `bool` to `u8` can be expressed infallibly using `From`
   --> sapemu/src/smp.rs:462:57
    |
462 |         let half_carry_result = (op1 & 0x0f) + (op2 & 0x0f) + self.carry() as u8 >= 0x10;
    |                                                               ^^^^^^^^^^^^^^^^^^
    |
    = help: an `as` cast can become silently lossy if the types change in the future
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
    = note: `-D clippy::cast-lossless` implied by `-D clippy::pedantic`
    = help: to override `-D clippy::pedantic` add `#[allow(clippy::cast_lossless)]`
help: use `u8::from` instead
    |
462 |         let half_carry_result = (op1 & 0x0f) + (op2 & 0x0f) + u8::from(self.carry()) >= 0x10;
    |                                                               ~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 1969 in sapemu/src/smp/ops.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this operation has no effect

error: this operation has no effect
    --> sapemu/src/smp/ops.rs:1969:12
     |
1969 |             cpu.y = (modulus & 0xff) as u8;
     |                     ^^^^^^^^^^^^^^^^ help: consider reducing it to: `modulus`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

Check failure on line 1969 in sapemu/src/smp/ops.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`u8` -> `u8`)

error: casting to the same type is unnecessary (`u8` -> `u8`)
    --> sapemu/src/smp/ops.rs:1969:12
     |
1969 |             cpu.y = (modulus & 0xff) as u8;
     |                     ^^^^^^^^^^^^^^^^^^^^^^ help: try: `(modulus & 0xff)`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check failure on line 1968 in sapemu/src/smp/ops.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this operation has no effect

error: this operation has no effect
    --> sapemu/src/smp/ops.rs:1968:12
     |
1968 |             cpu.a = (div & 0xff) as u8;
     |                     ^^^^^^^^^^^^ help: consider reducing it to: `div`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

Check failure on line 1968 in sapemu/src/smp/ops.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`u8` -> `u8`)

error: casting to the same type is unnecessary (`u8` -> `u8`)
    --> sapemu/src/smp/ops.rs:1968:12
     |
1968 |             cpu.a = (div & 0xff) as u8;
     |                     ^^^^^^^^^^^^^^^^^^ help: try: `(div & 0xff)`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
     = note: `-D clippy::unnecessary-cast` implied by `-D clippy::all`
     = help: to override `-D clippy::all` add `#[allow(clippy::unnecessary_cast)]`

Check failure on line 1965 in sapemu/src/smp/ops.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this operation has no effect

error: this operation has no effect
    --> sapemu/src/smp/ops.rs:1965:42
     |
1965 |             cpu.psw.set(ProgramStatusWord::Sign, ((div & 0xff) as i8) < 0);
     |                                                   ^^^^^^^^^^^^ help: consider reducing it to: `div`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
     = note: `-D clippy::identity-op` implied by `-D clippy::all`
     = help: to override `-D clippy::all` add `#[allow(clippy::identity_op)]`