Skip to content

sapemu: Implement tcall #672

sapemu: Implement tcall

sapemu: Implement tcall #672

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

clippy

7 errors

Details

Results

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

Versions

  • rustc 1.82.0-nightly (2cbbe8b8b 2024-07-28)
  • cargo 1.82.0-nightly (b5d44db1d 2024-07-26)
  • clippy 0.1.82 (2cbbe8b 2024-07-28)

Annotations

Check failure on line 465 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:465:3
    |
465 |         self.sp as u16 + 0x100
    |         ^^^^^^^^^^^^^^
    |
    = 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
    |
465 |         u16::from(self.sp) + 0x100
    |         ~~~~~~~~~~~~~~~~~~

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

See this annotation in the file changed.

@github-actions github-actions / clippy

this could be a `const fn`

error: this could be a `const fn`
   --> sapemu/src/smp.rs:464:2
    |
464 | /     pub fn stack_top(&self) -> u16 {
465 | |         self.sp as u16 + 0x100
466 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
note: the lint level is defined here
   --> sapemu/src/main.rs:2:62
    |
2   | #![deny(missing_docs, unused, clippy::all, clippy::pedantic, clippy::nursery, rustdoc::all)]
    |                                                              ^^^^^^^^^^^^^^^
    = note: `#[deny(clippy::missing_const_for_fn)]` implied by `#[deny(clippy::nursery)]`
help: make the function `const`
    |
464 |     pub const fn stack_top(&self) -> u16 {
    |         +++++

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

See this annotation in the file changed.

@github-actions github-actions / clippy

this method could have a `#[must_use]` attribute

error: this method could have a `#[must_use]` attribute
   --> sapemu/src/smp.rs:464:2
    |
464 |     pub fn stack_top(&self) -> u16 {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn stack_top(&self) -> u16`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
    = note: `#[deny(clippy::must_use_candidate)]` implied by `#[deny(clippy::pedantic)]`

Check failure on line 1828 in sapemu/src/smp/ops.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/ops.rs:1828:31
     |
1828 |             let upper_target_address = cpu.read(call_address + 1, memory) 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
     |
1828 |             let upper_target_address = u16::from(cpu.read(call_address + 1, memory));
     |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 1825 in sapemu/src/smp/ops.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/ops.rs:1825:49
     |
1825 |             MicroArchAction::Continue(state.with_address(lower_target_address 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
     |
1825 |             MicroArchAction::Continue(state.with_address(u16::from(lower_target_address)))
     |                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

See this annotation in the file changed.

@github-actions github-actions / clippy

this match arm has an identical body to another arm

error: this match arm has an identical body to another arm
    --> sapemu/src/smp/ops.rs:1817:3
     |
1817 |         2 => MicroArchAction::Continue(state),
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: try changing either arm body
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
     = note: `#[deny(clippy::match_same_arms)]` implied by `#[deny(clippy::pedantic)]`
help: or try merging the arm patterns
     |
1817 |         2 | 4 => MicroArchAction::Continue(state),
     |         ~~~~~
help: and remove this obsolete arm
     |
1822 -         4 => MicroArchAction::Continue(state),
     |

Check failure on line 1807 in sapemu/src/smp/ops.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/ops.rs:1807:30
     |
1807 |     let call_address = 0xFFDE - INDEX as u16 * 2;
     |                                 ^^^^^^^^^^^^
     |
     = 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: the lint level is defined here
    --> sapemu/src/main.rs:2:44
     |
2    | #![deny(missing_docs, unused, clippy::all, clippy::pedantic, clippy::nursery, rustdoc::all)]
     |                                            ^^^^^^^^^^^^^^^^
     = note: `#[deny(clippy::cast_lossless)]` implied by `#[deny(clippy::pedantic)]`
help: use `u16::from` instead
     |
1807 |     let call_address = 0xFFDE - u16::from(INDEX) * 2;
     |                                 ~~~~~~~~~~~~~~~~