INNER CODE UNIT · Rust
breaking_changes
topgrade-rs/topgrade · build.rs:10
fn breaking_changes() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let version_str = env::var("CARGO_PKG_VERSION").unwrap();
let changelog = parse_changelog::parse(include_str!("CHANGELOG.md")).expect("Invalid CHANGELOG.md");
let release = changelog
.get(&*version_str)
.expect("Current release not found in CHANGELOG.md");
let breaking_changes = release
.notes
// Get the part after the header
.split_once("### Breaking changes")
// Until the next header
.map(|(_, after)| {
after
.split_once("###")
.map(|(before, _)| before)
// If this is the last section, just return the entire thing
.unwrap_or(after)