From 96c43dfdd0933c39941355274cad00c3c650bcdd Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Fri, 28 Aug 2026 10:52:32 -0500 Subject: [PATCH] chore(path): drop debug_assert from set_file_name These two were transcribed verbatim from std's `PathBuf::_set_file_name` during the original port and are not a pattern used anywhere else in the crate. They also assert something the surrounding code already guarantees: `pop` returns `false` only when `parent` is `None`, which the enclosing `file_name().is_some()` check has already ruled out. Claude-Session: https://claude.ai/code/session_01A5uCQTmXn119ATyfP27hfe --- src/common/non_utf8/pathbuf.rs | 3 +-- src/common/utf8/pathbuf.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/common/non_utf8/pathbuf.rs b/src/common/non_utf8/pathbuf.rs index 593b8b4..769bbd0 100644 --- a/src/common/non_utf8/pathbuf.rs +++ b/src/common/non_utf8/pathbuf.rs @@ -301,8 +301,7 @@ where fn _set_file_name(&mut self, file_name: &[u8]) { if self.file_name().is_some() { - let popped = self.pop(); - debug_assert!(popped); + self.pop(); } self.push(file_name); } diff --git a/src/common/utf8/pathbuf.rs b/src/common/utf8/pathbuf.rs index 16e85b6..17edfdf 100644 --- a/src/common/utf8/pathbuf.rs +++ b/src/common/utf8/pathbuf.rs @@ -302,8 +302,7 @@ where fn _set_file_name(&mut self, file_name: &str) { if self.file_name().is_some() { - let popped = self.pop(); - debug_assert!(popped); + self.pop(); } self.push(file_name); }