Skip to content

bump_for

The largest version bump called for by any of commits.

One breaking change means Bump::Major; otherwise a feat means Bump::Minor, a fix Bump::Patch, and commits of other types (docs, tests, chores) do not bump the version. An empty list gives Bump::None.

use helpers4::commit::bump_for;

Cargo feature commit (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features commit

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.6", default-features = false, features = ["commit"] }
pub fn bump_for(commits: &[Commit]) -> Bump
ParameterTypeDescription
commits&[Commit]The parsed commits of a release, in any order.

Bump — The bump to apply to the current version.

use helpers4::commit::{bump_for, Bump, Commit};

let commits = [
    Commit::parse("docs: update the readme")?,
    Commit::parse("fix: handle empty input")?,
    Commit::parse("feat: add a helper")?,
];
assert_eq!(bump_for(&commits), Bump::Minor);

src/commit/bump_for.rs