diff --git a/.clippy.toml b/.clippy.toml index fc3ef79..d83b8e7 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1,13 @@ -msrv = "1.54.0" # MSRV +msrv = "1.64.0" # MSRV +warn-on-all-wildcard-imports = 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/renovate.json5 b/.github/renovate.json5 index 53161ba..4a91ac3 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,10 +1,41 @@ { - "schedule": [ - "before 3am on the first day of the month" + schedule: [ + 'before 5am on the first day of the month', ], - "semanticCommits": "enabled", - "configMigration": true, - "packageRules": [ + semanticCommits: 'enabled', + configMigration: true, + dependencyDashboard: true, + regexManagers: [ + { + fileMatch: [ + '^rust-toolchain\\.toml$', + 'Cargo.toml$', + 'clippy.toml$', + '\\.clippy.toml$', + '^\\.github/workflows/ci.yml$', + '^\\.github/workflows/rust-next.yml$', + ], + matchStrings: [ + 'MSRV.*?(?\\d+\\.\\d+(\\.\\d+)?)', + '(?\\d+\\.\\d+(\\.\\d+)?).*?MSRV', + ], + depNameTemplate: 'rust', + packageNameTemplate: 'rust-lang/rust', + datasourceTemplate: 'github-releases', + }, + ], + packageRules: [ + { + commitMessageTopic: 'MSRV', + matchManagers: [ + 'regex', + ], + matchPackageNames: [ + 'rust', + ], + minimumReleaseAge: "252 days", // 6 releases * 6 weeks per release * 7 days per week + internalChecksFilter: "strict", + }, // Goals: // - Keep version reqs low, ignoring compatible normal/build dependencies // - Take advantage of latest dev-dependencies @@ -12,34 +43,60 @@ // - Help keep number of versions down by always using latest breaking change // - Have lockfile and manifest in-sync { - "matchManagers": ["cargo"], - "matchDepTypes": ["build-dependencies", "dependencies"], - "matchCurrentVersion": ">=0.1.0", - "matchUpdateTypes": ["patch"], - "enabled": false, + matchManagers: [ + 'cargo', + ], + matchDepTypes: [ + 'build-dependencies', + 'dependencies', + ], + matchCurrentVersion: '>=0.1.0', + matchUpdateTypes: [ + 'patch', + ], + enabled: false, }, { - "matchManagers": ["cargo"], - "matchDepTypes": ["build-dependencies", "dependencies"], - "matchCurrentVersion": ">=1.0.0", - "matchUpdateTypes": ["minor"], - "enabled": false, + matchManagers: [ + 'cargo', + ], + matchDepTypes: [ + 'build-dependencies', + 'dependencies', + ], + matchCurrentVersion: '>=1.0.0', + matchUpdateTypes: [ + 'minor', + ], + enabled: false, }, { - "matchManagers": ["cargo"], - "matchDepTypes": ["dev-dependencies"], - "matchCurrentVersion": ">=0.1.0", - "matchUpdateTypes": ["patch"], - "automerge": true, - "groupName": "compatible (dev)", + matchManagers: [ + 'cargo', + ], + matchDepTypes: [ + 'dev-dependencies', + ], + matchCurrentVersion: '>=0.1.0', + matchUpdateTypes: [ + 'patch', + ], + automerge: true, + groupName: 'compatible (dev)', }, { - "matchManagers": ["cargo"], - "matchDepTypes": ["dev-dependencies"], - "matchCurrentVersion": ">=1.0.0", - "matchUpdateTypes": ["minor"], - "automerge": true, - "groupName": "compatible (dev)", + matchManagers: [ + 'cargo', + ], + matchDepTypes: [ + 'dev-dependencies', + ], + matchCurrentVersion: '>=1.0.0', + matchUpdateTypes: [ + 'minor', + ], + automerge: true, + groupName: 'compatible (dev)', }, ], } diff --git a/.github/settings.yml b/.github/settings.yml index b1151c7..dc288ab 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,39 +1,46 @@ # These settings are synced to GitHub by https://probot.github.io/apps/settings/ repository: - description: ROFF (man page format) generation library - homepage: docs.rs/roff - topics: rust cli man roff + description: "ROFF (man page format) generation library" + homepage: "docs.rs/roff" + topics: "rust cli man roff" has_issues: true has_projects: false has_wiki: false has_downloads: true default_branch: master - allow_squash_merge: true + # Preference: people do clean commits allow_merge_commit: true - allow_rebase_merge: true + # Backup in case we need to clean up commits + allow_squash_merge: true + # Not really needed + allow_rebase_merge: false - # Manual: allow_auto_merge: true, see https://github.com/probot/settings/issues/402 + allow_auto_merge: true delete_branch_on_merge: true + squash_merge_commit_title: "PR_TITLE" + squash_merge_commit_message: "PR_BODY" + merge_commit_message: "PR_BODY" + labels: # Type - name: bug color: '#b60205' - description: Not as expected + description: "Not as expected" - name: enhancement color: '#1d76db' - description: Improve the expected + description: "Improve the expected" # Flavor - name: question color: "#cc317c" - description: Uncertainty is involved + description: "Uncertainty is involved" - name: breaking-change color: "#e99695" - name: good first issue color: '#c2e0c6' - description: Help wanted! + description: "Help wanted!" branches: - name: master diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 0afe8a2..de95fb2 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,21 +1,49 @@ name: Security audit + +permissions: + contents: read + on: pull_request: paths: - '**/Cargo.toml' - '**/Cargo.lock' push: - paths: - - '**/Cargo.toml' - - '**/Cargo.lock' - schedule: - - cron: '18 18 6 * *' + branches: + - master + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + jobs: security_audit: + permissions: + issues: write # to create issues (actions-rs/audit-check) + checks: write # to create check (actions-rs/audit-check) runs-on: ubuntu-latest + # Prevent sudden announcement of a new advisory from failing ci: + continue-on-error: true steps: - name: Checkout repository uses: actions/checkout@v3 - uses: actions-rs/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} + + cargo_deny: + permissions: + issues: write # to create issues (actions-rs/audit-check) + checks: write # to create check (actions-rs/audit-check) + runs-on: ubuntu-latest + strategy: + matrix: + checks: + - bans licenses sources + steps: + - uses: actions/checkout@v3 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + command: check ${{ matrix.checks }} + rust-version: stable diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index defbfba..716e565 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,23 +1,23 @@ name: CI + +permissions: + contents: read + on: pull_request: - paths: - - '**' - - '!/*.md' - - '!/docs/**' - - "!/LICENSE-*" push: branches: - master - paths: - - '**' - - '!/*.md' - - '!/docs/**' - - "!/LICENSE-*" - schedule: - - cron: '18 18 6 * *' + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + jobs: ci: + permissions: + contents: none name: CI needs: [test, msrv, docs, rustfmt, clippy] runs-on: ubuntu-latest @@ -38,11 +38,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust }} - profile: minimal - override: true - uses: Swatinem/rust-cache@v2 - name: Build run: cargo test --no-run --workspace --all-features @@ -53,17 +51,15 @@ jobs: - name: No-default features run: cargo test --workspace --no-default-features msrv: - name: "Check MSRV: 1.54.0" + name: "Check MSRV: 1.64.0" runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.54.0 # MSRV - profile: minimal - override: true + toolchain: 1.64.0 # MSRV - uses: Swatinem/rust-cache@v2 - name: Default features run: cargo check --workspace --all-targets @@ -71,6 +67,18 @@ jobs: run: cargo check --workspace --all-targets --all-features - name: No-default features run: cargo check --workspace --all-targets --no-default-features + lockfile: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + - name: "Is lockfile updated?" + run: cargo fetch --locked docs: name: Docs runs-on: ubuntu-latest @@ -78,11 +86,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: stable - profile: minimal - override: true - uses: Swatinem/rust-cache@v2 - name: Check documentation env: @@ -95,13 +101,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: # Not MSRV because its harder to jump between versions and people are # more likely to have stable toolchain: stable - profile: minimal - override: true components: rustfmt - uses: Swatinem/rust-cache@v2 - name: Check formatting @@ -109,18 +113,32 @@ jobs: clippy: name: clippy runs-on: ubuntu-latest + permissions: + security-events: write # to upload sarif results steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.54.0 # MSRV - profile: minimal - override: true + toolchain: 1.64.0 # MSRV components: clippy - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/clippy-check@v1 + - name: Install SARIF tools + run: cargo install clippy-sarif --version 0.3.4 --locked # Held back due to msrv + - name: Install SARIF tools + run: cargo install sarif-fmt --version 0.3.4 --locked # Held back due to msrv + - name: Check + run: > + cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated + | clippy-sarif + | tee clippy-results.sarif + | sarif-fmt + continue-on-error: true + - name: Upload + uses: github/codeql-action/upload-sarif@v2 with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --all-features --all-targets -- -D warnings --allow deprecated + sarif_file: clippy-results.sarif + wait-for-processing: true + - name: Report status + run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated diff --git a/.github/workflows/committed.yml b/.github/workflows/committed.yml index 5d2f297..509be08 100644 --- a/.github/workflows/committed.yml +++ b/.github/workflows/committed.yml @@ -3,6 +3,14 @@ name: Lint Commits on: [pull_request] +permissions: + contents: read + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + jobs: committed: name: Lint Commits diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 852d7c9..afa45f7 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,10 +1,21 @@ name: pre-commit + +permissions: {} # none + on: pull_request: push: branches: [master] + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + jobs: pre-commit: + permissions: + contents: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/rust-next.yml b/.github/workflows/rust-next.yml index d7ab3f7..d57304a 100644 --- a/.github/workflows/rust-next.yml +++ b/.github/workflows/rust-next.yml @@ -1,7 +1,17 @@ name: rust-next + +permissions: + contents: read + on: schedule: - cron: '18 18 6 * *' + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + jobs: test: name: Test @@ -18,11 +28,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust }} - profile: minimal - override: true - uses: Swatinem/rust-cache@v2 - name: Default features run: cargo test --workspace @@ -30,49 +38,22 @@ jobs: run: cargo test --workspace --all-features - name: No-default features run: cargo test --workspace --no-default-features - rustfmt: - name: rustfmt - strategy: - matrix: - rust: - - stable - - beta - continue-on-error: ${{ matrix.rust != 'stable' }} - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - profile: minimal - override: true - components: rustfmt - - uses: Swatinem/rust-cache@v2 - - name: Check formatting - run: cargo fmt --all -- --check - clippy: - name: clippy - strategy: - matrix: - rust: - - 1.54.0 # MSRV - - stable - continue-on-error: ${{ matrix.rust != '1.54.0' }} # MSRV + latest: + name: "Check latest dependencies" runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: ${{ matrix.rust }} - profile: minimal - override: true - components: clippy + toolchain: stable - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --all-features --all-targets -- -D warnings + - name: Update dependencues + run: cargo update + - name: Default features + run: cargo test --workspace --all-targets + - name: All features + run: cargo test --workspace --all-targets --all-features + - name: No-default features + run: cargo test --workspace --all-targets --no-default-features diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 604b9ce..f31c7ed 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -1,6 +1,15 @@ name: Spelling + +permissions: + contents: read + on: [pull_request] +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + jobs: spelling: name: Spell Check with Typos diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 038f814..3d9e40f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.4.0 hooks: - id: check-yaml stages: [commit] @@ -15,12 +15,12 @@ repos: - id: detect-private-key stages: [commit] - repo: https://github.com/crate-ci/typos - rev: v1.4.1 + rev: v1.16.3 hooks: - id: typos stages: [commit] - repo: https://github.com/crate-ci/committed - rev: v1.0.1 + rev: v1.0.20 hooks: - id: committed stages: [commit-msg] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 631ab0e..6d1f64f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to assert_cmd +# Contributing to roff-rs Thanks for wanting to contribute! There are many ways to contribute and we appreciate any level you're willing to do. @@ -29,12 +29,12 @@ to re-work some of it and the discouragement that goes along with that. ### Process -When you first post a PR, we request that the the commit history get cleaned -up. We recommend avoiding this during the PR to make it easier to review how -feedback was handled. Once the commit is ready, we'll ask you to clean up the -commit history. Once you let us know this is done, we can move forward with -merging! If you are uncomfortable with these parts of git, let us know and we -can help. +Before posting a PR, we request that the commit history get cleaned up. +However, we recommend avoiding this during the review to make it easier to +check how feedback was handled. Once the PR is ready, we'll ask you to clean up +the commit history from the review. Once you let us know this is done, we can +move forward with merging! If you are uncomfortable with these parts of git, +let us know and we can help. For commit messages, we use [Conventional](https://www.conventionalcommits.org) style. If you already wrote your commits and don't feel comfortable changing @@ -49,6 +49,7 @@ As a heads up, we'll be running your PR through the following gauntlet: - `clippy` - `rustdoc` - [`committed`](https://github.com/crate-ci/committed) +- [`typos`](https://github.com/crate-ci/typos) ## Releasing @@ -56,13 +57,13 @@ Pre-requisites - Running `cargo login` - A member of `rust-cli:Maintainers` - Push permission to the repo +- [`cargo-release`](https://github.com/crate-ci/cargo-release/) When we're ready to release, a project owner should do the following -1. Update the changelog +1. Update the changelog (see `cargo release changes` for ideas) 2. Determine what the next version is, according to semver 3. Run [`cargo release -x `](https://github.com/crate-ci/cargo-release) -[issues]: https://github.com/assert-rs/assert_cmd/issues -[new issue]: https://github.com/assert-rs/assert_cmd/issues/new -[all issues]: https://github.com/assert-rs/assert_cmd/issues?utf8=%E2%9C%93&q=is%3Aissue -[travis]: https://github.com/assert-rs/assert_cmd/blob/master/.travis.yml +[issues]: https://github.com/rust-cli/roff-rs/issues +[new issue]: https://github.com/rust-cli/roff-rs/issues/new +[all issues]: https://github.com/rust-cli/roff-rs/issues?utf8=%E2%9C%93&q=is%3Aissue diff --git a/Cargo.toml b/Cargo.toml index 483cec7..b5a5812 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,25 +1,39 @@ -[package] -name = "roff" -version = "0.2.1" -description = "ROFF (man page format) generation library" +[workspace] +resolver = "2" + +[workspace.package] license = "MIT OR Apache-2.0" -repository = "https://github.com/rust-cli/roff-rs" -homepage = "https://github.com/rust-cli/roff-rs" -documentation = "https://docs.rs/roff" -readme = "README.md" -categories = ["development-tools::testing"] -keywords = ["cli", "man", "roff"] -edition = "2018" +edition = "2021" +rust-version = "1.64.0" # MSRV include = [ "build.rs", "src/**/*", "Cargo.toml", + "Cargo.lock", "LICENSE*", "README.md", "benches/**/*", "examples/**/*" ] +[package] +name = "roff" +version = "0.2.1" +description = "ROFF (man page format) generation library" +repository = "https://github.com/rust-cli/roff-rs" +homepage = "https://github.com/rust-cli/roff-rs" +documentation = "https://docs.rs/roff" +readme = "README.md" +categories = ["development-tools::testing"] +license.workspace = true +edition.workspace = true +rust-version.workspace = true +include.workspace = true + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [package.metadata.release] pre-release-replacements = [ {file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1}, diff --git a/LICENSE-MIT b/LICENSE-MIT index a27b7ac..a2d0108 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2015 The roff-rs Developers +Copyright (c) Individual contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..942e08d --- /dev/null +++ b/deny.toml @@ -0,0 +1,139 @@ +# Note that all fields that take a lint level have these possible values: +# * deny - An error will be produced and the check will fail +# * warn - A warning will be produced, but the check will not fail +# * allow - No warning or error will be produced, though in some cases a note +# will be + +# This section is considered when running `cargo deny check advisories` +# More documentation for the advisories section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html +[advisories] +# The lint level for security vulnerabilities +vulnerability = "deny" +# The lint level for unmaintained crates +unmaintained = "warn" +# The lint level for crates that have been yanked from their source registry +yanked = "warn" +# The lint level for crates with security notices. Note that as of +# 2019-12-17 there are no security notice advisories in +# https://github.com/rustsec/advisory-db +notice = "warn" +# A list of advisory IDs to ignore. Note that ignored advisories will still +# output a note when they are encountered. +# +# e.g. "RUSTSEC-0000-0000", +ignore = [ +] + +# This section is considered when running `cargo deny check licenses` +# More documentation for the licenses section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html +[licenses] +unlicensed = "deny" +# List of explicitly allowed licenses +# See https://spdx.org/licenses/ for list of possible licenses +# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. +allow = [ + "MIT", + "MIT-0", + "Apache-2.0", + "BSD-3-Clause", + "MPL-2.0", + "Unicode-DFS-2016", + "CC0-1.0", +] +# List of explicitly disallowed licenses +# See https://spdx.org/licenses/ for list of possible licenses +# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. +deny = [ +] +# Lint level for licenses considered copyleft +copyleft = "deny" +# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses +# * both - The license will be approved if it is both OSI-approved *AND* FSF +# * either - The license will be approved if it is either OSI-approved *OR* FSF +# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF +# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved +# * neither - This predicate is ignored and the default lint level is used +allow-osi-fsf-free = "neither" +# Lint level used when no other predicates are matched +# 1. License isn't in the allow or deny lists +# 2. License isn't copyleft +# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither" +default = "deny" +# The confidence threshold for detecting a license from license text. +# The higher the value, the more closely the license text must be to the +# canonical license text of a valid SPDX license file. +# [possible values: any between 0.0 and 1.0]. +confidence-threshold = 0.8 +# Allow 1 or more licenses on a per-crate basis, so that particular licenses +# aren't accepted for every possible crate as with the normal allow list +exceptions = [ + # Each entry is the crate and version constraint, and its specific allow + # list + #{ allow = ["Zlib"], name = "adler32", version = "*" }, +] + +[licenses.private] +# If true, ignores workspace crates that aren't published, or are only +# published to private registries. +# To see how to mark a crate as unpublished (to the official registry), +# visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field. +ignore = true + +# This section is considered when running `cargo deny check bans`. +# More documentation about the 'bans' section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html +[bans] +# Lint level for when multiple versions of the same crate are detected +multiple-versions = "warn" +# Lint level for when a crate version requirement is `*` +wildcards = "deny" +# The graph highlighting used when creating dotgraphs for crates +# with multiple versions +# * lowest-version - The path to the lowest versioned duplicate is highlighted +# * simplest-path - The path to the version with the fewest edges is highlighted +# * all - Both lowest-version and simplest-path are used +highlight = "all" +# The default lint level for `default` features for crates that are members of +# the workspace that is being checked. This can be overridden by allowing/denying +# `default` on a crate-by-crate basis if desired. +workspace-default-features = "allow" +# The default lint level for `default` features for external crates that are not +# members of the workspace. This can be overridden by allowing/denying `default` +# on a crate-by-crate basis if desired. +external-default-features = "allow" +# List of crates that are allowed. Use with care! +allow = [ + #{ name = "ansi_term", version = "=0.11.0" }, +] +# List of crates to deny +deny = [ + # Each entry the name of a crate and a version range. If version is + # not specified, all versions will be matched. + #{ name = "ansi_term", version = "=0.11.0" }, + # + # Wrapper crates can optionally be specified to allow the crate when it + # is a direct dependency of the otherwise banned crate + #{ name = "ansi_term", version = "=0.11.0", wrappers = [] }, +] + +# This section is considered when running `cargo deny check sources`. +# More documentation about the 'sources' section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html +[sources] +# Lint level for what to happen when a crate from a crate registry that is not +# in the allow list is encountered +unknown-registry = "deny" +# Lint level for what to happen when a crate from a git repository that is not +# in the allow list is encountered +unknown-git = "deny" +# List of URLs for allowed crate registries. Defaults to the crates.io index +# if not specified. If it is specified but empty, no registries are allowed. +allow-registry = ["https://github.com/rust-lang/crates.io-index"] +# List of URLs for allowed Git repositories +allow-git = [] + +[sources.allow-org] +# 1 or more github.com organizations to allow git sources for +github = [] diff --git a/release.toml b/release.toml index 18443e5..7aabc20 100644 --- a/release.toml +++ b/release.toml @@ -1,2 +1,3 @@ owners = ["github:rust-cli:Maintainers"] +dependent-version = "fix" allow-branch = ["master"] diff --git a/src/lib.rs b/src/lib.rs index dd451c8..1220e25 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,6 +18,7 @@ //! [groff(7)]: https://manpages.debian.org/bullseye/groff/groff.7.en.html #![warn(missing_docs)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] use std::io::Write; use std::write; @@ -322,7 +323,7 @@ fn escape_leading_cc(s: &str) -> String { /// text line: dashes and backslashes are escaped with a backslash. /// Apostrophes are not handled. fn escape_inline(text: &str) -> String { - text.replace(r"\", r"\\").replace('-', r"\-") + text.replace('\\', r"\\").replace('-', r"\-") } /// Handle apostrophes.