Fix clippy lints

This commit is contained in:
angie 2024-12-15 20:07:19 -03:00
parent 8e96ef8bd0
commit d8cfeedfb4
7 changed files with 301 additions and 86 deletions

View File

@ -4,8 +4,8 @@ name: Build and upload Rust crate
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
build_rust: check_fmt:
name: Build Rust stuff and run Rust tests name: Check format
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -21,6 +21,20 @@ jobs:
- name: Check format - name: Check format
run: cargo fmt --check run: cargo fmt --check
check_clippy:
name: Check clippy lints
runs-on: ubuntu-20.04
steps:
- name: Checkout reposistory
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Setup clippy - name: Setup clippy
run: rustup component add clippy run: rustup component add clippy
@ -29,12 +43,54 @@ jobs:
cargo clippy --version cargo clippy --version
cargo clippy --all-targets --all-features -- -D warnings cargo clippy --all-targets --all-features -- -D warnings
- name: Build Rust package run_tests:
run: cargo build --release --workspace name: Run Rust tests
runs-on: ubuntu-20.04
steps:
- name: Checkout reposistory
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build Rust tests - name: Build Rust tests
run: cargo test --workspace run: cargo test --workspace
msrv:
runs-on: ubuntu-latest
steps:
- name: Checkout reposistory
uses: actions/checkout@v4
- name: Setup MSRV checker
uses: taiki-e/install-action@cargo-hack
# To find current MSRV use `cargo msrv find`. Install it with `cargo install cargo-msrv --locked`
- name: Run MSRV checker
run: cargo hack check --rust-version --workspace --all-targets --ignore-private
publish_crate:
name: Publish the crate!
runs-on: ubuntu-20.04
needs: [check_fmt, check_clippy, run_tests, msrv]
steps:
- name: Checkout reposistory
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build Rust package
run: cargo build --release --workspace
- name: Publish dry run - name: Publish dry run
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
run: cargo publish --dry-run run: cargo publish --dry-run

View File

@ -1,11 +1,11 @@
name: Build and upload to PyPI name: Build and upload to PyPI
# Only run on releases # Only run on releases
on: # on:
push: # push:
# Pattern matched against refs/tags # # Pattern matched against refs/tags
tags: # tags:
- '**' # Push events to every tag including hierarchical tags like v1.0/beta # - '**' # Push events to every tag including hierarchical tags like v1.0/beta
jobs: jobs:
build_wheels: build_wheels:

4
.gitignore vendored
View File

@ -218,10 +218,6 @@ cython_debug/
# will have compiled files and executables # will have compiled files and executables
/target/ /target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt # These are backup files generated by rustfmt
**/*.rs.bk **/*.rs.bk

View File

@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
- Set MSRV (minimal supported Rust version) to 1.66.1.
### Fixed ### Fixed
- Fix some instructions missing their corresponding AccessType. - Fix some instructions missing their corresponding AccessType.
- Fix some new clippy lints.
## [1.12.0] - 2024-07-21 ## [1.12.0] - 2024-07-21

159
Cargo.lock generated Normal file
View File

@ -0,0 +1,159 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "cc"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf"
dependencies = [
"shlex",
]
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "hashbrown"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
[[package]]
name = "indexmap"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "num_enum"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9"
dependencies = [
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "once_cell"
version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]]
name = "proc-macro-crate"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
"once_cell",
"toml_edit",
]
[[package]]
name = "proc-macro2"
version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rabbitizer"
version = "1.12.1"
dependencies = [
"cc",
"glob",
"num_enum",
]
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "toml_datetime"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
[[package]]
name = "toml_edit"
version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap",
"toml_datetime",
"winnow",
]
[[package]]
name = "unicode-ident"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]]
name = "winnow"
version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]

View File

@ -11,6 +11,7 @@ description = "MIPS instruction decoder"
readme = "README.md" readme = "README.md"
repository = "https://github.com/Decompollaborate/rabbitizer" repository = "https://github.com/Decompollaborate/rabbitizer"
license-file = "LICENSE" license-file = "LICENSE"
rust-version = "1.66.1"
keywords = ["MIPS", "decoder"] keywords = ["MIPS", "decoder"]
build = "rust/build.rs" build = "rust/build.rs"
include = ["/rust/src", "/rust/build.rs", "/src", "/include", "/tables"] include = ["/rust/src", "/rust/build.rs", "/src", "/include", "/tables"]

View File

@ -4,41 +4,40 @@
use crate::{registers_enum, RegisterDescriptor}; use crate::{registers_enum, RegisterDescriptor};
extern "C" { extern "C" {
pub static mut RabbitizerRegister_GprO32_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_GprO32_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_GprN32_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_GprN32_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_Cop0_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_Cop0_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_Cop1O32_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_Cop1O32_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_Cop1N32_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_Cop1N32_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_Cop1N64_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_Cop1N64_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_Cop1Control_Names: pub static RabbitizerRegister_Cop1Control_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static RabbitizerRegister_Cop2_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static RabbitizerRegister_RspGpr_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static RabbitizerRegister_RspCop0_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static RabbitizerRegister_RspCop2_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static RabbitizerRegister_RspCop2Control_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_Cop2_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_RspVector_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_RspGpr_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_R4000AllegrexS_Names:
pub static mut RabbitizerRegister_RspCop0_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_RspCop2_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_RspCop2Control_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_RspVector_Names: [[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_R4000AllegrexV2D_Names:
pub static mut RabbitizerRegister_R4000AllegrexS_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexV2D_Names: pub static RabbitizerRegister_R4000AllegrexV3D_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexV3D_Names: pub static RabbitizerRegister_R4000AllegrexV4D_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexV4D_Names: pub static RabbitizerRegister_R4000AllegrexM2x2_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexM2x2_Names: pub static RabbitizerRegister_R4000AllegrexM3x3_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexM3x3_Names: pub static RabbitizerRegister_R4000AllegrexM4x4_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexM4x4_Names: pub static RabbitizerRegister_R4000AllegrexVfpuControl_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexVfpuControl_Names: pub static RabbitizerRegister_R4000AllegrexVConstant_Names:
[[*const core::ffi::c_char; 2usize]; 0usize]; [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexVConstant_Names: pub static RabbitizerRegister_R5900VF_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
[[*const core::ffi::c_char; 2usize]; 0usize]; pub static RabbitizerRegister_R5900VI_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R5900VF_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R5900VI_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
/* /*
pub fn RabbitizerRegister_getNameGpr(reg_value: u8) -> *const core::ffi::c_char; pub fn RabbitizerRegister_getNameGpr(reg_value: u8) -> *const core::ffi::c_char;
@ -57,41 +56,40 @@ extern "C" {
pub fn RabbitizerRegister_getNameR5900VI(reg_value: u8) -> *const core::ffi::c_char; pub fn RabbitizerRegister_getNameR5900VI(reg_value: u8) -> *const core::ffi::c_char;
*/ */
pub static mut RabbitizerRegister_GprO32_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_GprO32_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_GprN32_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_GprN32_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_Cop0_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_Cop0_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_Cop1O32_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_Cop1O32_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_Cop1N32_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_Cop1N32_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_Cop1N64_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_Cop1N64_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_Cop1Control_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_Cop1Control_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_Cop2_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_Cop2_Descriptors: [RegisterDescriptor; 0usize];
/* RSP */ /* RSP */
pub static mut RabbitizerRegister_RspGpr_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_RspGpr_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_RspCop0_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_RspCop0_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_RspCop2_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_RspCop2_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_RspCop2Control_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_RspCop2Control_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_RspVector_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_RspVector_Descriptors: [RegisterDescriptor; 0usize];
/* RSP */ /* RSP */
pub static mut RabbitizerRegister_R4000AllegrexS_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R4000AllegrexS_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexV2D_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R4000AllegrexV2D_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexV3D_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R4000AllegrexV3D_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexV4D_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R4000AllegrexV4D_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexM2x2_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R4000AllegrexM2x2_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexM3x3_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R4000AllegrexM3x3_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexM4x4_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R4000AllegrexM4x4_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexVfpuControl_Descriptors: pub static RabbitizerRegister_R4000AllegrexVfpuControl_Descriptors:
[RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexVConstant_Descriptors:
[RegisterDescriptor; 0usize]; [RegisterDescriptor; 0usize];
pub static RabbitizerRegister_R4000AllegrexVConstant_Descriptors: [RegisterDescriptor; 0usize];
/* R5900 */ /* R5900 */
pub static mut RabbitizerRegister_R5900VF_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R5900VF_Descriptors: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R5900VI_Descriptors: [RegisterDescriptor; 0usize]; pub static RabbitizerRegister_R5900VI_Descriptors: [RegisterDescriptor; 0usize];
/* R5900 */ /* R5900 */
} }