dejadoc 0.2.0

Find duplicated Rust doctests across a workspace
Documentation
---
name: Mutants

"on":
  pull_request:
  push:
    branches:
      - main

permissions:
  contents: read

concurrency:
  group: mutants-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always

jobs:
  mutants:
    name: Mutation testing
    runs-on: ubuntu-latest
    timeout-minutes: 45
    # The --exclude-re flags drop documented unobservable mutants (plans/dejadoc.md);
    # cargo-mutants exits 2 on any missed mutant, so every exclusion pairs with a test
    # pinning the observable siblings that share the same description.
    # Tab arithmetic: the four-column decision and the dedent boundary both cross
    # column four at the same character for every +- and %/ variant.
    # block_star_strip: the star-predicate and blank-line gate mutants never change
    # a scanned doctest; their killable twins are pinned by tests with the same name.
    # flat_literal: the closing-offset sum is equivalent for literals
    # without a raw-string hash run, 1 - 0 equals 1 + 0 there.
    if: >-
      github.event_name == 'push' ||
      (github.event.pull_request.head.repo.full_name == github.repository &&
      github.event.pull_request.user.login != 'dependabot[bot]')
    steps:
      - uses: actions/checkout@v4

      - name: Cache cargo downloads
        uses: actions/cache@v6
        with:
          path: |
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
          key: dl-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            dl-${{ runner.os }}-

      - uses: dtolnay/rust-toolchain@stable

      - name: Install cargo-mutants
        run: cargo install cargo-mutants --locked

      - name: Run mutants
        run: >-
          cargo mutants --cap-lints true --timeout 180
          -E 'delete match arm (syn::)?(ImplItem|TraitItem|ForeignItem)::Macro\(m\) in (impl_assoc_name|trait_assoc_name|foreign_name|assoc_attrs|trait_assoc_attrs|foreign_attrs)'
          -E 'replace match guard mac\.path\.is_ident\("concat"\) with true'
          -E 'replace \|\| with && in single_segment_type_name'
          -E 'replace \+ with [-*] in merge_parts'
          -E 'replace > with >= in block_star_strip'
          -E 'delete ! in block_star_strip'
          -E 'replace == with != in block_star_strip'
          -E 'replace \+ with - in flat_literal'