Skip to content

Commit 9761ca6

Browse files
committed
tmpfiles: remove unused TmpfilesEntryRef; simplify helpers (covers/kind)
Signed-off-by: Rishi Jat <[email protected]>
1 parent 488a48b commit 9761ca6

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

crates/tmpfiles/src/lib.rs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -507,15 +507,6 @@ fn tmpfiles_entry_get_path(line: &str) -> Result<PathBuf> {
507507
unescape_path(&mut it)
508508
}
509509

510-
/// A parsed tmpfiles entry kind and path of interest.
511-
#[derive(Debug, Clone, PartialEq, Eq)]
512-
pub struct TmpfilesEntryRef {
513-
/// The entry type character (e.g. 'd', 'L', 'z', 'Z', ...)
514-
pub kind: char,
515-
/// The target path for the entry
516-
pub path: PathBuf,
517-
}
518-
519510
/// Chown-affecting tmpfiles.d entries summary
520511
#[derive(Debug, Default, Clone)]
521512
pub struct TmpfilesChowners {
@@ -528,28 +519,12 @@ pub struct TmpfilesChowners {
528519
impl TmpfilesChowners {
529520
/// Returns true if a chown entry would apply to the specified absolute path
530521
pub fn covers(&self, p: &Path) -> bool {
531-
if self.exact.contains(p) {
532-
return true;
533-
}
534-
// For recursive entries, any ancestor match qualifies
535-
for anc in p.ancestors() {
536-
if self.recursive.contains(anc) {
537-
return true;
538-
}
539-
}
540-
false
522+
self.exact.contains(p) || p.ancestors().any(|anc| self.recursive.contains(anc))
541523
}
542524
}
543525

544526
fn tmpfiles_entry_get_kind(line: &str) -> Option<char> {
545-
let mut it = line.bytes();
546-
// Skip leading whitespace
547-
while let Some(c) = it.next() {
548-
if !c.is_ascii_whitespace() {
549-
return Some(c as char);
550-
}
551-
}
552-
None
527+
line.trim_start().chars().next()
553528
}
554529

555530
/// Read tmpfiles.d entries and return only those affecting chown operations (z/Z)

0 commit comments

Comments
 (0)