Skip to content

Commit ae487e3

Browse files
committed
Let opt_interpolate return the plain string if path is None
1 parent 118cc58 commit ae487e3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CHANGELOG-rust.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ This changelog tracks the Rust `svdtools` project. See
55

66
## [Unreleased]
77

8+
* If there is no path to interpolate, show unmodified `description`.
9+
810
## [v0.3.13] 2024-03-29
911

1012
* Interpolate path and name in `description` and `derivedFrom`

src/patch/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ impl Spec for str {
805805

806806
fn opt_interpolate<T: Interpolate>(path: &Option<&T>, s: Option<&str>) -> Option<String> {
807807
path.and_then(|path| path.interpolate_opt(s))
808+
.or_else(|| s.map(ToString::to_string))
808809
}
809810

810811
trait Interpolate {

0 commit comments

Comments
 (0)