Skip to content

Commit eb91f92

Browse files
committed
allow underscore in spec
1 parent b4f3770 commit eb91f92

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

CHANGELOG-rust.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This changelog tracks the Rust `svdtools` project. See
66
## [Unreleased]
77

88
* Interpolate path and name in `description` and `derivedFrom`
9+
* Allow specs started with `_` (missing part)
910

1011
## [v0.3.12] 2024-03-23
1112

src/patch/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,6 @@ fn newglob(spec: &str) -> globset::GlobMatcher {
259259

260260
/// If a name matches a specification, return the first sub-specification that it matches
261261
fn matchsubspec<'a>(name: &str, spec: &'a str) -> Option<&'a str> {
262-
if spec.starts_with('_') {
263-
return None;
264-
}
265262
if spec.contains('{') {
266263
let glob = newglob(spec);
267264
if glob.is_match(name) {
@@ -731,9 +728,7 @@ fn spec_ind(spec: &str) -> Option<(usize, usize)> {
731728
Regex::new(r"^[\w%]*((?:[\?*]|\[\d+(?:-\d+)?\]|\[[a-zA-Z]+(?:-[a-zA-Z]+)?\])+)[\w%]*$")
732729
.unwrap()
733730
});
734-
let Some(caps) = RE.captures(spec) else {
735-
return None;
736-
};
731+
let caps = RE.captures(spec)?;
737732
let spec = caps.get(0).unwrap();
738733
let token = caps.get(1).unwrap();
739734
let li = token.start();

0 commit comments

Comments
 (0)