diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f5e1983b7..0b82b2f76 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,12 +20,13 @@ jobs: steps: - uses: actions/checkout@v6 - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }} + - run: rustup component add rustfmt - uses: Swatinem/rust-cache@v2 - run: cargo fmt --check - clippy: - name: Run lints + machete: + name: Detect unused dependencies runs-on: ubuntu-latest + needs: [format] strategy: matrix: toolchain: @@ -33,36 +34,84 @@ jobs: steps: - uses: actions/checkout@v6 - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - run: rustup component add clippy rustfmt --toolchain ${{ matrix.toolchain }} + - uses: bnjbvr/cargo-machete@main + clippy_debug: + name: Run lints (debug) + runs-on: ubuntu-latest + needs: [machete] + strategy: + matrix: + toolchain: + - stable + steps: + - uses: actions/checkout@v6 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + - run: rustup component add clippy - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --all-targets --all-features + - name: Clippy (debug) + run: cargo clippy --all-targets --all-features + clippy_release: + name: Run lints (release) + runs-on: ubuntu-latest + needs: [machete] + strategy: + matrix: + toolchain: + - stable + steps: + - uses: actions/checkout@v6 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + - run: rustup component add clippy + - uses: Swatinem/rust-cache@v2 + - name: Clippy (release) + run: cargo clippy --release --all-targets --all-features build_and_test: name: Build project and test runs-on: ${{ matrix.os }} + needs: [clippy_debug, clippy_release] strategy: matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-latest, macos-15-intel] + os: + [ + ubuntu-latest, + ubuntu-24.04-arm, + windows-latest, + windows-11-arm, + macos-latest, + macos-15-intel, + ] toolchain: - stable steps: - uses: actions/checkout@v6 - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }} + - uses: taiki-e/install-action@nextest - uses: Swatinem/rust-cache@v2 - - run: cargo test --verbose + - name: Cargo nextest + run: cargo nextest run --verbose + - name: Cargo doctest + run: cargo test --doc --verbose build_release: name: Build project in release runs-on: ${{ matrix.os }} + needs: [build_and_test] strategy: matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-latest, macos-15-intel] + os: + [ + ubuntu-latest, + ubuntu-24.04-arm, + windows-latest, + windows-11-arm, + macos-latest, + macos-15-intel, + ] toolchain: - stable steps: - uses: actions/checkout@v6 - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }} - uses: Swatinem/rust-cache@v2 - name: Build Release shell: bash @@ -83,20 +132,6 @@ jobs: name: pumpkin-${{ runner.arch }}-${{ runner.os }} compression-level: 9 path: dist/pumpkin-* - - clippy_release: - name: Run lints in release mode - runs-on: ubuntu-latest - strategy: - matrix: - toolchain: - - stable - steps: - - uses: actions/checkout@v6 - - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - run: rustup component add clippy rustfmt --toolchain ${{ matrix.toolchain }} - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --release --all-targets --all-features draft_release: permissions: contents: write diff --git a/Cargo.lock b/Cargo.lock index fc8c6e1c3..16d770a9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2158,7 +2158,6 @@ dependencies = [ "bytes", "console-subscriber", "crossbeam", - "dashmap", "flate2", "futures", "hmac 0.13.0-rc.4", @@ -2182,7 +2181,6 @@ dependencies = [ "serde_json", "sha1", "sha2 0.11.0-rc.4", - "signature 2.2.0", "simplelog", "tempfile", "thiserror", @@ -2253,7 +2251,6 @@ name = "pumpkin-macros" version = "0.1.0-dev+1.21.11" dependencies = [ "proc-macro-error2", - "proc-macro2", "pumpkin-data", "quote", "syn", diff --git a/pumpkin-data/Cargo.toml b/pumpkin-data/Cargo.toml index fd12bafda..c87b690f0 100644 --- a/pumpkin-data/Cargo.toml +++ b/pumpkin-data/Cargo.toml @@ -39,4 +39,7 @@ harness = false # Generated files generate a lot of warns # [lints] -# workspace = true \ No newline at end of file +# workspace = true + +[package.metadata.cargo-machete] +ignored = ["phf"] diff --git a/pumpkin-macros/Cargo.toml b/pumpkin-macros/Cargo.toml index 4756fb5c8..3592abdb2 100644 --- a/pumpkin-macros/Cargo.toml +++ b/pumpkin-macros/Cargo.toml @@ -12,9 +12,8 @@ proc-macro-error2.workspace = true pumpkin-data.workspace = true -proc-macro2.workspace = true quote.workspace = true syn.workspace = true [lints] -workspace = true \ No newline at end of file +workspace = true diff --git a/pumpkin-world/Cargo.toml b/pumpkin-world/Cargo.toml index 5f763c64e..fc7fef285 100644 --- a/pumpkin-world/Cargo.toml +++ b/pumpkin-world/Cargo.toml @@ -88,3 +88,6 @@ tokio_taskdump = [] # [lints] # workspace = true + +[package.metadata.cargo-machete] +ignored = ["serde_json"] diff --git a/pumpkin/Cargo.toml b/pumpkin/Cargo.toml index 90fa2b118..eed7c66f7 100644 --- a/pumpkin/Cargo.toml +++ b/pumpkin/Cargo.toml @@ -53,7 +53,6 @@ bytes.workspace = true rand.workspace = true num-bigint.workspace = true -dashmap.workspace = true # Console line reading rustyline.workspace = true @@ -89,7 +88,7 @@ tokio-util = { workspace = true, features = ["rt"] } flate2.workspace = true console-subscriber = { workspace = true, optional = true } -signature.workspace = true + [dev-dependencies] tempfile.workspace = true diff --git a/pumpkin/src/plugin/api/context.rs b/pumpkin/src/plugin/api/context.rs index 0f5f54a20..e78387f42 100644 --- a/pumpkin/src/plugin/api/context.rs +++ b/pumpkin/src/plugin/api/context.rs @@ -101,7 +101,7 @@ impl Context { /// /// # Example /// - /// ``` + /// ```ignore /// context.register_service("my_service", Arc::new(MyService::new())).await; /// ``` pub async fn register_service, T: Payload + 'static>( @@ -132,7 +132,7 @@ impl Context { /// /// # Example /// - /// ``` + /// ```ignore /// if let Some(service) = context.get_service::("my_service").await { /// // Use the service /// } @@ -283,7 +283,7 @@ impl Context { /// /// # Example /// - /// ```no_run + /// ```ignore /// // Create and register a custom Lua plugin loader /// let lua_loader = Arc::new(LuaPluginLoader::new()); /// context.register_plugin_loader(lua_loader).await;