From 9083d06b9488502acaacaa8fd308eb05139b9c13 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 20 Oct 2026 11:12:38 -0500 Subject: [PATCH 1/3] chore: Update from epage/_rust template --- .cargo/config.toml | 2 + .clippy.toml | 12 ++ .github/PULL_REQUEST_TEMPLATE.md | 16 +++ .github/workflows/build.yml | 152 ----------------------- .github/workflows/ci.yml | 188 ++++++++++++++++++++++++++++ .github/workflows/rust-next.yml | 78 ++++++++++++ .github/workflows/spelling.yml | 27 +++++ AI_POLICY.md | 58 +++++++++ CHANGELOG.md | 8 +- Cargo.toml | 58 +++++---- LICENSE-APACHE | 202 +++++++++++++++++++++++++++++++ LICENSE => LICENSE-MIT | 2 - 12 files changed, 624 insertions(+), 179 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 .clippy.toml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/rust-next.yml create mode 100644 .github/workflows/spelling.yml create mode 100644 AI_POLICY.md create mode 100644 LICENSE-APACHE rename LICENSE => LICENSE-MIT (97%) diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000000..4a6a1abdd6 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[resolver] +incompatible-rust-versions = "fallback" diff --git a/.clippy.toml b/.clippy.toml new file mode 100644 index 0000000000..1d4c5dc66f --- /dev/null +++ b/.clippy.toml @@ -0,0 +1,12 @@ +allow-print-in-tests = true +allow-expect-in-tests = true +allow-unwrap-in-tests = true +allow-dbg-in-tests = true +disallowed-methods = [ + { path = "std::option::Option::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" }, + { path = "std::option::Option::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" }, + { path = "std::result::Result::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" }, + { path = "std::result::Result::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" }, + { path = "std::iter::Iterator::for_each", reason = "prefer `for` for side-effects" }, + { path = "std::iter::Iterator::try_for_each", reason = "prefer `for` for side-effects" }, +] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..cc42102fda --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ + + +### What does this PR try to solve? + + +Closes # + +### Notes to reviewers + + + +LLM involvement: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 64e2c9d0ef..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,152 +0,0 @@ -name: build - -permissions: - contents: read - -on: - pull_request: - push: - branches: - - master - -env: - RUST_BACKTRACE: 1 - CARGO_TERM_COLOR: always - CLICOLOR: 1 - -concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" - cancel-in-progress: true - -jobs: - build: - permissions: - contents: none - name: CI - needs: [test, msrv, lockfile, rustfmt, clippy] - runs-on: ubuntu-latest - if: "always()" - steps: - - name: Failed - run: exit 1 - if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')" - test: - name: Test - strategy: - matrix: - os: ["ubuntu-latest", "windows-latest", "macos-latest"] - rust: ["stable"] - continue-on-error: ${{ matrix.rust != 'stable' }} - runs-on: ${{ matrix.os }} - env: - # Reduce amount of data cached - CARGO_PROFILE_DEV_DEBUG: line-tables-only - steps: - - name: Checkout repository - uses: actions/checkout@v6.0.2 - with: - persist-credentials: false - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ matrix.rust }} - - name: Initialize cache - uses: Swatinem/rust-cache@v2.9.1 - - name: Install cargo-hack - uses: taiki-e/install-action@v2.75.4 - with: - tool: cargo-hack - - name: Build - run: cargo test --workspace --no-run - - name: Test - run: cargo hack test --each-feature --workspace - msrv: - name: "Check MSRV" - strategy: - matrix: - os: ["ubuntu-latest"] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout repository - uses: actions/checkout@v6.0.2 - with: - persist-credentials: false - - name: Install Rust - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - with: - toolchain: stable - - name: Initialize cache - uses: Swatinem/rust-cache@v2.9.1 - - name: Install cargo-hack - uses: taiki-e/install-action@v2.75.4 - with: - tool: cargo-hack - - name: Default features - run: cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going - lockfile: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v6.0.2 - with: - persist-credentials: false - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - - name: Initialize cache - uses: Swatinem/rust-cache@v2.9.1 - - name: "Is lockfile updated?" - run: cargo update --workspace --locked - rustfmt: - name: rustfmt - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v6.0.2 - with: - persist-credentials: false - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - components: rustfmt - - name: Initialize cache - uses: Swatinem/rust-cache@v2.9.1 - - name: Check formatting - run: cargo fmt --check - clippy: - name: clippy - runs-on: ubuntu-latest - permissions: - security-events: write # to upload sarif results - steps: - - name: Checkout repository - uses: actions/checkout@v6.0.2 - with: - persist-credentials: false - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - components: clippy - - name: Initialize cache - uses: Swatinem/rust-cache@v2.9.1 - - name: Install SARIF tools - run: cargo install clippy-sarif --locked - - name: Install SARIF tools - run: cargo install sarif-fmt --locked - - name: Check - run: > - cargo clippy --workspace --all-features --all-targets --message-format=json - | clippy-sarif - | tee clippy-results.sarif - | sarif-fmt - continue-on-error: true - - name: Upload - uses: github/codeql-action/upload-sarif@v4.35.1 - with: - sarif_file: clippy-results.sarif - wait-for-processing: true - - name: Report status - run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings --allow deprecated diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..4f473afe46 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,188 @@ +name: CI + +permissions: + contents: read + +on: + pull_request: + push: + branches: + - main + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + CARGO_INCREMENTAL: 0 + RUST_TOOLCHAIN_STABLE: "1.98" # STABLE + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + ci: + permissions: + contents: none + name: CI + needs: [test, msrv, lockfile, docs, rustfmt, clippy] + runs-on: ubuntu-latest + if: "always()" + steps: + - name: Failed + run: exit 1 + if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')" + test: + name: Test + strategy: + matrix: + os: ["ubuntu-latest", "windows-latest", "macos-latest"] + rust: ["stable"] + continue-on-error: ${{ matrix.rust != 'stable' }} + runs-on: ${{ matrix.os }} + env: + # Reduce amount of data cached + CARGO_PROFILE_DEV_DEBUG: line-tables-only + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Install cargo-hack + uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d # v2.87.0 + with: + tool: cargo-hack + - name: Build + run: cargo test --workspace --no-run + - name: Test + run: cargo hack test --each-feature --workspace + msrv: + name: "Check MSRV" + strategy: + matrix: + os: ["ubuntu-latest"] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update stable && rustup default stable + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Install cargo-hack + uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d # v2.87.0 + with: + tool: cargo-hack + - name: Default features + run: cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going + lockfile: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update stable && rustup default stable + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: "Is lockfile updated?" + run: cargo update --workspace --locked + docs: + name: Docs + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update $RUST_TOOLCHAIN_STABLE && rustup default $RUST_TOOLCHAIN_STABLE + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Check documentation + env: + CARGO_BUILD_WARNINGS: deny + run: cargo doc --workspace --all-features --no-deps --document-private-items --keep-going + rustfmt: + name: rustfmt + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update $RUST_TOOLCHAIN_STABLE && rustup default $RUST_TOOLCHAIN_STABLE + - name: Install rustfmt + run: rustup component add rustfmt + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Check formatting + run: cargo fmt --check + clippy: + name: clippy + runs-on: ubuntu-latest + permissions: + security-events: write # to upload sarif results + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update $RUST_TOOLCHAIN_STABLE && rustup default $RUST_TOOLCHAIN_STABLE + - name: Install clippy + run: rustup component add clippy + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Install SARIF tools + run: cargo install clippy-sarif --locked + - name: Install SARIF tools + run: cargo install sarif-fmt --locked + - name: Check + run: > + cargo clippy --workspace --all-features --all-targets --message-format=json + | clippy-sarif + | tee clippy-results.sarif + | sarif-fmt + continue-on-error: true + - name: Upload + uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9 + with: + sarif_file: clippy-results.sarif + wait-for-processing: true + - name: Report status + env: + CARGO_BUILD_WARNINGS: deny + run: cargo clippy --workspace --all-features --all-targets --keep-going -- --allow deprecated --allow renamed_and_removed_lints + coverage: + name: Coverage + runs-on: ubuntu-latest + permissions: + code-quality: write + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update stable && rustup default stable + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Install cargo-tarpaulin + run: cargo install cargo-tarpaulin + - name: Gather coverage + run: cargo tarpaulin --out xml + - name: Upload coverage report + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + uses: actions/upload-code-coverage@d8e329117199404bba6fc81efe8093dc7c015e34 # v1.4.2 + with: + file: cobertura.xml + language: Rust diff --git a/.github/workflows/rust-next.yml b/.github/workflows/rust-next.yml new file mode 100644 index 0000000000..bef678a01b --- /dev/null +++ b/.github/workflows/rust-next.yml @@ -0,0 +1,78 @@ +name: rust-next + +permissions: + contents: read + +on: + schedule: + - cron: '1 1 1 * *' + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + CARGO_INCREMENTAL: 0 + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + test: + name: Test + strategy: + matrix: + os: ["ubuntu-latest", "windows-latest", "macos-latest"] + rust: ["stable", "beta"] + include: + - os: ubuntu-latest + rust: "nightly" + continue-on-error: ${{ matrix.rust != 'stable' }} + runs-on: ${{ matrix.os }} + env: + # Reduce amount of data cached + CARGO_PROFILE_DEV_DEBUG: line-tables-only + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Install cargo-hack + uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d # v2.87.0 + with: + tool: cargo-hack + - name: Build + run: cargo test --workspace --no-run + - name: Test + run: cargo hack test --each-feature --workspace + latest: + name: "Check latest dependencies" + strategy: + matrix: + os: ["ubuntu-latest"] + runs-on: ${{ matrix.os }} + env: + CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: allow + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install Rust + run: rustup update --no-self-update stable && rustup default stable + - name: Initialize cache + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Install cargo-hack + uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d # v2.87.0 + with: + tool: cargo-hack + - name: Update dependencies + run: cargo update + - name: Build + run: cargo test --workspace --no-run + - name: Test + run: cargo hack test --each-feature --workspace diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml new file mode 100644 index 0000000000..6321dae201 --- /dev/null +++ b/.github/workflows/spelling.yml @@ -0,0 +1,27 @@ +name: Spelling + +permissions: + contents: read + +on: [pull_request] + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + spelling: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Spell Check Repo + uses: crate-ci/typos@4d9c206a77c041268485162b8e2579ad7a5cb9a3 # v1.50.0 diff --git a/AI_POLICY.md b/AI_POLICY.md new file mode 100644 index 0000000000..b2ad65fd2e --- /dev/null +++ b/AI_POLICY.md @@ -0,0 +1,58 @@ +# AI policy + +Project maintainers are responsible for any code that is published as part of a release. +Contributors are responsible for their contributions, both in terms of communications and code. +This responsibility is for both understanding of and the quality of their contributions. + +## Personal use + +You are free to use an AI locally for your own purposes, +including to answer your questions, analyze, distill, refine, check, suggest, and review. + +## Communication + +**AI should not be used to generate comments when communicating with maintainers.** +We expect comments on our projects to be written by humans. +We may hide or delete any comments where we believe AI generation was involved. + +If you are opening an issue, +we expect you to have personally reproduced the problem and to describe it in your own words. + +If you are opening a pull request, +we expect you to be able to explain the proposed changes in your own words. +This includes the pull request body and responses to questions. +**Do not copy responses from an AI when replying to questions from maintainers.** +Do not run agents or bots on pull requests without first getting approval. + +We understand that AI is useful when communicating as a non-native English speaker. +If you are using AI to edit your comments for this purpose, +please take the time to ensure it reflects your own voice and ideas. +If using AI for translation, we recommend writing in your native language and including the AI translation in a [`
` block]. + +If you wish to include context from an interaction with AI in your comments, +it must be in a [`
` block] and disclosed as such. +The block must include human commentary explaining the relevance and implications of the context. +The content of your comment must stand on its own even without the quoted content. +Do not share long snippets. + +## Code + +Using AI as tools for coding requires receiving permission on the relevant issue before a PR is posted. + +This project requires a human in the loop who understands the work produced by AI. +**We do not allow autonomous agents to be used for contributing to this project**. +We will close any pull requests that we believe were created **without meaningful involvement** from the contributor. +Contributions should not "read" as being written by an AI. + +Some areas require specific expertise or care when touching. +AI generated code, even with human review, is prohibited for: +- none + +We view AI as providing a way to improve quality and will hold AI-assisted contributions to a higher standard. +We will be more free in asking for changes. + +The involvement of AI assistance must be disclosed in PRs. + +For documentation, including comments in code, see [Communication](#communication). + +[`
` block]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf8d1e91d..ebddd5c275 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ -# Changelog +# Change Log +All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog]. - -[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ +The format is based on [Keep a Changelog](https://keepachangelog.com/) +and this project adheres to [Semantic Versioning](https://semver.org/). ## Unreleased - ReleaseDate diff --git a/Cargo.toml b/Cargo.toml index ed02b5b36b..74a2c41c94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,11 @@ [package] -authors = [ - "Without Boats ", - "Pascal Hertleif ", - "Sebastian Garrido ", - "Jonas Platte ", - "Benjamin Gill ", - "Andronik Ordian ", -] +name = "cargo-edit" +version = "0.13.13" +description = "Cargo commands for modifying a `Cargo.toml` file.." categories = [ "development-tools", "development-tools::cargo-plugins", ] -description = "Cargo commands for modifying a `Cargo.toml` file.." -documentation = "https://github.com/killercup/cargo-edit/blob/master/README.md#available-subcommands" keywords = [ "cargo", "cargo-subcommand", @@ -20,19 +13,18 @@ keywords = [ "dependencies", "crates", ] -license = "Apache-2.0 OR MIT" -name = "cargo-edit" -readme = "README.md" repository = "https://github.com/killercup/cargo-edit" -version = "0.13.13" +license = "MIT OR Apache-2.0" edition = "2024" rust-version = "1.97" [package.metadata.release] pre-release-replacements = [ {file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1}, + {file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1}, {file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1}, - {file="CHANGELOG.md", search="", replace="\n## Unreleased - ReleaseDate\n", exactly=1}, + {file="CHANGELOG.md", search="", replace="\n## [Unreleased] - ReleaseDate\n", exactly=1}, + {file="CHANGELOG.md", search="", replace="\n[Unreleased]: {{repository}}/compare/{{tag_name}}...HEAD", exactly=1}, ] [[bin]] @@ -90,11 +82,6 @@ trycmd = "1.2.0" snapbox = { version = "1.2.2", features = ["cmd", "path"] } cargo-test-support = "0.11.6" -[profile.release] -panic = "abort" -codegen-units = 1 -lto = true - [features] default = [ "add", @@ -112,6 +99,9 @@ test-external-apis = [] [lints.rust] rust_2018_idioms = { level = "warn", priority = -1 } + +non_ascii_idents = "warn" +trivial_numeric_casts = "warn" unnameable_types = "warn" unreachable_pub = "warn" unsafe_op_in_unsafe_fn = "warn" @@ -120,10 +110,17 @@ unused_macro_rules = "warn" unused_qualifications = "warn" [lints.clippy] +allow_attributes_without_reason = "warn" bool_assert_comparison = "allow" branches_sharing_code = "allow" +byte_char_slices = "allow" # sometimes explicit arrays are better +cast_possible_truncation = "warn" +cast_possible_wrap = "warn" +cast_sign_loss = "warn" checked_conversions = "warn" collapsible_else_if = "allow" +collapsible_match = "allow" +collection_is_never_read = "warn" create_dir = "warn" dbg_macro = "warn" debug_assert_with_mut_call = "warn" @@ -136,8 +133,10 @@ explicit_into_iter_loop = "warn" fallible_impl_from = "warn" filter_map_next = "warn" flat_map_option = "warn" +float_cmp = "warn" float_cmp_const = "warn" fn_params_excessive_bools = "warn" +fn_to_numeric_cast_any = "warn" if_same_then_else = "allow" implicit_clone = "warn" imprecise_flops = "warn" @@ -153,10 +152,12 @@ linkedlist = "warn" lossy_float_literal = "warn" macro_use_imports = "warn" mem_forget = "warn" +mismatching_type_param_order = "warn" mutex_integer = "warn" needless_continue = "allow" needless_for_each = "warn" negative_feature_names = "warn" +partial_pub_fields = "warn" path_buf_push_overwrite = "warn" ptr_as_ptr = "warn" rc_mutex = "warn" @@ -165,15 +166,30 @@ ref_option_ref = "warn" rest_pat_in_fully_bound_structs = "warn" result_large_err = "allow" same_functions_in_if_condition = "warn" -self_named_module_files = "allow" # false positive +self_named_module_files = "warn" semicolon_if_nothing_returned = "warn" +should_panic_without_expect = "warn" str_to_string = "warn" string_add = "warn" string_add_assign = "warn" string_lit_as_bytes = "warn" todo = "warn" trait_duplication_in_bounds = "warn" +undocumented_unsafe_blocks = "warn" uninlined_format_args = "warn" +unnecessary_safety_comment = "warn" +unnecessary_safety_doc = "warn" +unseparated_literal_suffix = "warn" +use_self = "warn" verbose_file_reads = "warn" wildcard_imports = "warn" zero_sized_map_values = "warn" + +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" +codegen-units = 1 +lto = true +debug = "line-tables-only" # requires Cargo 1.71 diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000000..6aa81fe017 --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright Individual contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/LICENSE b/LICENSE-MIT similarity index 97% rename from LICENSE rename to LICENSE-MIT index aa7fdf131d..a2d01088b6 100644 --- a/LICENSE +++ b/LICENSE-MIT @@ -1,5 +1,3 @@ -The MIT License (MIT) - Copyright (c) Individual contributors Permission is hereby granted, free of charge, to any person obtaining a copy From 650b76c1f7de313487cf447d32fddfd3381cc3d1 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 20 Oct 2026 11:14:08 -0500 Subject: [PATCH 2/3] style: Make clippy happy --- Cargo.toml | 4 ++-- src/bin/set-version/version.rs | 34 +++++++++++++++++----------------- src/dependency.rs | 4 ++-- src/errors.rs | 20 ++++++++++---------- src/fetch.rs | 4 ++-- src/manifest.rs | 4 ++-- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 74a2c41c94..48332b5a13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,7 +110,7 @@ unused_macro_rules = "warn" unused_qualifications = "warn" [lints.clippy] -allow_attributes_without_reason = "warn" +#allow_attributes_without_reason = "warn" bool_assert_comparison = "allow" branches_sharing_code = "allow" byte_char_slices = "allow" # sometimes explicit arrays are better @@ -157,7 +157,7 @@ mutex_integer = "warn" needless_continue = "allow" needless_for_each = "warn" negative_feature_names = "warn" -partial_pub_fields = "warn" +#partial_pub_fields = "warn" path_buf_push_overwrite = "warn" ptr_as_ptr = "warn" rc_mutex = "warn" diff --git a/src/bin/set-version/version.rs b/src/bin/set-version/version.rs index ad85b3446f..2ae4036353 100644 --- a/src/bin/set-version/version.rs +++ b/src/bin/set-version/version.rs @@ -17,7 +17,7 @@ impl TargetVersion { metadata: Option<&str>, ) -> CargoResult> { match self { - TargetVersion::Relative(bump_level) => { + Self::Relative(bump_level) => { let mut potential_version = current.to_owned(); bump_level.bump_version(&mut potential_version, metadata)?; if potential_version != *current { @@ -27,7 +27,7 @@ impl TargetVersion { Ok(None) } } - TargetVersion::Absolute(version) => { + Self::Absolute(version) => { if current < version { let mut version = version.clone(); if version.build.is_empty() { @@ -51,7 +51,7 @@ impl TargetVersion { impl Default for TargetVersion { fn default() -> Self { - TargetVersion::Relative(BumpLevel::Release) + Self::Relative(BumpLevel::Release) } } @@ -72,13 +72,13 @@ impl FromStr for BumpLevel { fn from_str(s: &str) -> Result { match s { - "major" => Ok(BumpLevel::Major), - "minor" => Ok(BumpLevel::Minor), - "patch" => Ok(BumpLevel::Patch), - "release" => Ok(BumpLevel::Release), - "rc" => Ok(BumpLevel::Rc), - "beta" => Ok(BumpLevel::Beta), - "alpha" => Ok(BumpLevel::Alpha), + "major" => Ok(Self::Major), + "minor" => Ok(Self::Minor), + "patch" => Ok(Self::Patch), + "release" => Ok(Self::Release), + "rc" => Ok(Self::Rc), + "beta" => Ok(Self::Beta), + "alpha" => Ok(Self::Alpha), _ => Err(String::from( "[valid values: major, minor, patch, rc, beta, alpha]", )), @@ -93,31 +93,31 @@ impl BumpLevel { metadata: Option<&str>, ) -> CargoResult<()> { match self { - BumpLevel::Major => { + Self::Major => { version.increment_major(); } - BumpLevel::Minor => { + Self::Minor => { version.increment_minor(); } - BumpLevel::Patch => { + Self::Patch => { if !version.is_prerelease() { version.increment_patch(); } else { version.pre = semver::Prerelease::EMPTY; } } - BumpLevel::Release => { + Self::Release => { if version.is_prerelease() { version.pre = semver::Prerelease::EMPTY; } } - BumpLevel::Rc => { + Self::Rc => { version.increment_rc()?; } - BumpLevel::Beta => { + Self::Beta => { version.increment_beta()?; } - BumpLevel::Alpha => { + Self::Alpha => { version.increment_alpha()?; } }; diff --git a/src/dependency.rs b/src/dependency.rs index a6074fb9c9..8d9d047498 100644 --- a/src/dependency.rs +++ b/src/dependency.rs @@ -626,8 +626,8 @@ impl std::fmt::Display for Source { } } -impl<'s> From<&'s Source> for Source { - fn from(inner: &'s Source) -> Self { +impl<'s> From<&'s Self> for Source { + fn from(inner: &'s Self) -> Self { inner.clone() } } diff --git a/src/errors.rs b/src/errors.rs index cda69afbe3..65ff9ad9a3 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -30,16 +30,16 @@ pub struct CliError { impl CliError { /// Attach an error code to an error - pub fn new(error: anyhow::Error, code: i32) -> CliError { - CliError { + pub fn new(error: anyhow::Error, code: i32) -> Self { + Self { error: Some(error), exit_code: code, } } /// Silent error - pub fn code(code: i32) -> CliError { - CliError { + pub fn code(code: i32) -> Self { + Self { error: None, exit_code: code, } @@ -47,23 +47,23 @@ impl CliError { } impl From for CliError { - fn from(err: anyhow::Error) -> CliError { - CliError::new(err, 101) + fn from(err: anyhow::Error) -> Self { + Self::new(err, 101) } } #[cfg(feature = "clap")] impl From for CliError { - fn from(err: clap::Error) -> CliError { + fn from(err: clap::Error) -> Self { #[allow(clippy::bool_to_int_with_if)] let code = if err.use_stderr() { 1 } else { 0 }; - CliError::new(err.into(), code) + Self::new(err.into(), code) } } impl From for CliError { - fn from(err: std::io::Error) -> CliError { - CliError::new(err.into(), 1) + fn from(err: std::io::Error) -> Self { + Self::new(err.into(), 1) } } diff --git a/src/fetch.rs b/src/fetch.rs index 7a31b8c0a6..f67691f631 100644 --- a/src/fetch.rs +++ b/src/fetch.rs @@ -15,13 +15,13 @@ pub struct RustVersion { impl RustVersion { /// Minimum-possible `package.rust-version` - pub const MIN: Self = RustVersion { + pub const MIN: Self = Self { major: 1, minor: 0, patch: 0, }; /// Maximum-possible `package.rust-version` - pub const MAX: Self = RustVersion { + pub const MAX: Self = Self { major: u64::MAX, minor: u64::MAX, patch: u64::MAX, diff --git a/src/manifest.rs b/src/manifest.rs index d4cb2e04e1..dc18dc8102 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -171,7 +171,7 @@ impl str::FromStr for Manifest { fn from_str(input: &str) -> ::std::result::Result { let d: toml_edit::DocumentMut = input.parse().context("Manifest not valid TOML")?; - Ok(Manifest { data: d }) + Ok(Self { data: d }) } } @@ -220,7 +220,7 @@ impl LocalManifest { } let data = fs::read_to_string(path).with_context(|| "Failed to read manifest contents")?; let manifest = data.parse().context("Unable to parse Cargo.toml")?; - Ok(LocalManifest { + Ok(Self { manifest, path: path.to_owned(), }) From 6dbdc9c66ddb5a4ccb897d4722bf12379bd56823 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 20 Oct 2026 11:15:17 -0500 Subject: [PATCH 3/3] docs: Fix typos --- src/fetch.rs | 2 +- src/manifest.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fetch.rs b/src/fetch.rs index f67691f631..4b00a30cef 100644 --- a/src/fetch.rs +++ b/src/fetch.rs @@ -2,7 +2,7 @@ use super::Dependency; use super::RegistrySource; use super::VersionExt; -/// Simplified represetation of `package.rust-version` +/// Simplified representation of `package.rust-version` #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub struct RustVersion { #[allow(missing_docs)] diff --git a/src/manifest.rs b/src/manifest.rs index dc18dc8102..fe9f20a7a1 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -273,7 +273,7 @@ impl LocalManifest { Ok(()) } - /// Allow mutating depedencies, wherever they live + /// Allow mutating dependencies, wherever they live pub fn get_dependency_tables_mut( &mut self, ) -> impl Iterator + '_ { @@ -439,7 +439,7 @@ fn remove_feature_activation( } } -/// If a manifest is specified, return that one, otherise perform a manifest search starting from +/// If a manifest is specified, return that one, otherwise perform a manifest search starting from /// the current directory. /// If a manifest is specified, return that one. If a path is specified, perform a manifest search /// starting from there. If nothing is specified, start searching from the current directory