ronantakizawa/codereview-bench huggingface dataset:
Repository: sxyazi/yazi
File: yazi-fs/src/cha/cha.rs (Rust)

Code before:
	}

	#[inline]
	pub fn hits(self, c: Self) -> bool {
		self.len == c.len
			&& self.mtime == c.mtime
			&& unix_either!(self.ctime == c.ctime, true)
			&& self.btime == c.btime
			&& self.kind == c.kind
			&& unix_either!(self.mode == c.mode, true)
	}

	#[inline]
	fn attach(mut self, kind: ChaKind) -> Self {
		self.kind |= kind;
		self
	}
}

impl Cha {
	#[inline]
	pub const fn is_hidden(&self) -> bool {
		win_either!(
			self.kind.contains(ChaKind::HIDDEN) || self.kind.contains(ChaKind::SYSTEM),
			self.kind.contains(ChaKind::HIDDEN)
		)
	}

	#[inline]
	pub const fn is_orphan(&self) -> bool { self.kind.contains(ChaKind::ORPHAN) }

	#[inline]
	pub const fn is_dummy(&self) -> bool { self.kind.contains(ChaKind::DUMMY) }

	pub fn atime_dur(&self) -> anyhow::Result<Duration> {
		if let Some(atime) = self.atime {
			Ok(atime.duration_since(UNIX_EPOCH)?)
		} else {
			bail!("atime not available");
		}
	}

	pub fn mtime_dur(&self) -> anyhow::Result<Duration> {
		if let Some(mtime) = self.mtime {
			Ok(mtime.duration_since(UNIX_EPOCH)?)
		} else {
			bail!("mtime not available");
		}
	}

	pub fn btime_dur(&self) -> anyhow::Result<Duration> {

Review comment (bug):
The logic for detecting orphaned symlinks appears incorrect. An orphaned symlink should be one that points to a non-existent target, but this implementation returns true when a symlink has been followed (FOLLOW flag is set). This seems backwards - orphaned symlinks should be those where following failed, not succeeded.
```suggestion
		*self.mode == ChaType::Link && !self.kind.contains(ChaKind::FOLLOW)
```

Code after:
	#[inline]
	pub fn hits(self, c: Self) -> bool {
		self.len == c.len
			&& self.mtime == c.mtime
			&& unix_either!(self.ctime == c.ctime, true)
			&& self.btime == c.btime
			&& self.kind == c.kind
			&& unix_either!(self.mode == c.mode, true)
	}

	#[inline]
	fn attach(mut self, kind: ChaKind) -> Self {
		self.kind |= kind;
		self
	}
}

impl Cha {
	#[inline]
	pub fn is_link(self) -> bool {
		self.kind.contains(ChaKind::FOLLOW) || *self.mode == ChaType::Link
	}

	#[inline]
	pub fn is_orphan(self) -> bool {
		*self.mode == ChaType::Link && self.kind.contains(ChaKind::FOLLOW)
	}

	#[inline]
	pub const fn is_hidden(self) -> bool {
		win_either!(
			self.kind.contains(ChaKind::HIDDEN) || self.kind.contains(ChaKind::SYSTEM),
			self.kind.contains(ChaKind::HIDDEN)
		)
	}

	#[inline]
	pub const fn is_dummy(self) -> bool { self.kind.contains(ChaKind::DUMMY) }

	pub fn atime_dur(self) -> anyhow::Result<Duration> {
		if let Some(atime) = self.atime {
			Ok(atime.duration_since(UNIX_EPOCH)?)
		} else {
			bail!("atime not available");
		}
	}

	pub fn mtime_dur(self) -> anyhow::Result<Duration> {
		if let Some(mtime) = self.mtime {
			Ok(mtime.duration_since(UNIX_EPOCH)?)
		} else {
Repository: sxyazi/yazi
File: yazi-fs/src/error/serde.rs (Rust)

Code before:
}

impl<'de> Deserialize<'de> for Error {
	fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
	where
		D: Deserializer<'de>,
	{
		#[derive(Deserialize)]
		#[serde(tag = "type", rename_all = "kebab-case")]
		enum Shadow {
			Kind { kind: String },
			Raw { code: i32 },
			Dyn { kind: String, code: Option<i32>, message: String },
		}

		let shadow = Shadow::deserialize(deserializer)?;
		Ok(match shadow {
			Shadow::Kind { kind } => Error::Kind(kind_from_str(&kind)),
			Shadow::Raw { code } => Error::Raw(code),
			Shadow::Dyn { kind, code, message } => {
				if let Some(code) = code {
					Error::Raw(code)
				} else if message.is_empty() {
					Error::Kind(kind_from_str(&kind))
				} else {
					Error::Custom { kind: kind_from_str(&kind), code, message: message.into() }
				}
			}
		})
	}
}


Review comment (suggestion):
The deserialization logic prioritizes `code` over `message`, which could lead to loss of information. If both `code` and `message` are present, the message is discarded in favor of creating a `Raw` error. Consider creating a `Custom` error when both are available to preserve all available information.
```suggestion
				match (code, message.is_empty()) {
					(Some(code), false) => Error::Custom { kind: kind_from_str(&kind), code: Some(code), message: message.into() },
					(Some(code), true) => Error::Raw(code),
					(None, true) => Error::Kind(kind_from_str(&kind)),
					(None, false) => Error::Custom { kind: kind_from_str(&kind), code: None, message: message.into() },
```

Code after:
}

impl<'de> Deserialize<'de> for Error {
	fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
	where
		D: Deserializer<'de>,
	{
		#[derive(Deserialize)]
		#[serde(tag = "type", rename_all = "kebab-case")]
		enum Shadow {
			Kind { kind: String },
			Raw { code: i32 },
			Dyn { kind: String, code: Option<i32>, message: String },
		}

		let shadow = Shadow::deserialize(deserializer)?;
		Ok(match shadow {
			Shadow::Kind { kind } => Error::Kind(kind_from_str(&kind)),
			Shadow::Raw { code } => Error::Raw(code),
			Shadow::Dyn { kind, code, message } => {
				if !message.is_empty() {
					Error::Custom { kind: kind_from_str(&kind), code, message: message.into() }
				} else if let Some(code) = code {
					Error::Raw(code)
				} else {
					Error::Kind(kind_from_str(&kind))
				}
			}
		})
	}
}
Repository: sxyazi/yazi
File: yazi-scheduler/src/file/progress.rs (Rust)

Code before:
	}
}

impl FileProgPaste {
	pub fn running(self) -> bool {
		!self.collected || self.success_files + self.failed_files != self.total_files
	}

	pub fn success(self) -> bool { self.collected && self.success_files == self.total_files }

	pub fn cleaned(self) -> bool { self.cleaned }

	pub fn percent(self) -> Option<f32> {
		Some(if self.success() {
			100.0
		} else if self.total_bytes == 0 {
			99.99
		} else {
			99.99f32.min(self.processed_bytes as f32 / self.total_bytes as f32 * 100.0)
		})
	}
}

// --- Link
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize)]
pub struct FileProgLink {
	pub state: Option<bool>,
}

impl From<FileProgLink> for TaskSummary {
	fn from(value: FileProgLink) -> Self {
		Self {
			total:   1,
			success: (value.state == Some(true)) as u32,
			failed:  (value.state == Some(false)) as u32,
			percent: value.percent().map(Into::into),
		}
	}
}

impl FileProgLink {
	pub fn running(self) -> bool { self.state.is_none() }

	pub fn success(self) -> bool { self.state == Some(true) }

	pub fn cleaned(self) -> bool { false }

	pub fn percent(self) -> Option<f32> { None }
}

// --- Hardlink

Review comment (bug):
[nitpick] Returning 0.0% for failed tasks may be misleading in UI contexts where 0% typically indicates no progress rather than failure. Consider using a special value or None to distinguish between 'no progress' and 'failed'.

Code after:
	}
}

impl FileProgPaste {
	pub fn running(self) -> bool {
		self.collected.is_none() || self.success_files + self.failed_files != self.total_files
	}

	pub fn success(self) -> bool {
		self.collected == Some(true) && self.success_files == self.total_files
	}

	pub fn failed(self) -> bool { self.collected == Some(false) }

	pub fn cleaned(self) -> bool { self.cleaned }

	pub fn percent(self) -> Option<f32> {
		Some(if self.success() {
			100.0
		} else if self.failed() {
			0.0
		} else if self.total_bytes != 0 {
			99.99f32.min(self.processed_bytes as f32 / self.total_bytes as f32 * 100.0)
		} else {
			99.99
		})
	}
}

// --- Link
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize)]
pub struct FileProgLink {
	pub state: Option<bool>,
}

impl From<FileProgLink> for TaskSummary {
	fn from(value: FileProgLink) -> Self {
		Self {
			total:   1,
			success: (value.state == Some(true)) as u32,
			failed:  (value.state == Some(false)) as u32,
			percent: value.percent().map(Into::into),
		}
	}
}

impl FileProgLink {
	pub fn running(self) -> bool { self.state.is_none() }

	pub fn success(self) -> bool { self.state == Some(true) }
Repository: sxyazi/yazi
File: yazi-fs/src/hash.rs (Rust)

Code before:
	fn hash_u64(&self) -> u64;
}

impl FsHash64 for File {
	fn hash_u64(&self) -> u64 { foldhash::fast::FixedState::default().hash_one(self) }
}

impl<T: AsUrl> FsHash64 for T {
	fn hash_u64(&self) -> u64 { foldhash::fast::FixedState::default().hash_one(self.as_url()) }
}

// Hash128
pub trait FsHash128 {
	fn hash_u128(&self) -> u128;
}

impl FsHash128 for Cha {
	fn hash_u128(&self) -> u128 {
		let mut h = Twox128::default();

		self.kind.bits().hash(&mut h);
		self.mode.bits().hash(&mut h);
		self.len.hash(&mut h);

		self.mtime_dur().ok().map(|d| d.as_nanos()).hash(&mut h);
		self.btime_dur().ok().map(|d| d.as_nanos()).hash(&mut h);
		self.ctime_dur().ok().map(|d| d.as_nanos()).hash(&mut h);

		h.finish_128()
	}
}

impl<T: AsUrl> FsHash128 for T {
	fn hash_u128(&self) -> u128 {
		let mut h = Twox128::default();
		self.as_url().hash(&mut h);
		h.finish_128()
	}
}


Review comment (suggestion):
The reordering of btime_dur and mtime_dur hash operations changes the hash computation order. While this may be intentional for the PR's purposes, this is a breaking change that will cause previously computed hashes to differ from new ones. Consider documenting this breaking change or adding a migration path if hash persistence is important.

Code after:
	fn hash_u64(&self) -> u64;
}

impl FsHash64 for File {
	fn hash_u64(&self) -> u64 { foldhash::fast::FixedState::default().hash_one(self) }
}

impl<T: AsUrl> FsHash64 for T {
	fn hash_u64(&self) -> u64 { foldhash::fast::FixedState::default().hash_one(self.as_url()) }
}

// Hash128
pub trait FsHash128 {
	fn hash_u128(&self) -> u128;
}

impl FsHash128 for Cha {
	fn hash_u128(&self) -> u128 {
		let mut h = Twox128::default();

		self.kind.bits().hash(&mut h);
		self.mode.bits().hash(&mut h);
		self.len.hash(&mut h);

		self.btime_dur().ok().map(|d| d.as_nanos()).hash(&mut h);
		self.mtime_dur().ok().map(|d| d.as_nanos()).hash(&mut h);

		h.finish_128()
	}
}

impl<T: AsUrl> FsHash128 for T {
	fn hash_u128(&self) -> u128 {
		let mut h = Twox128::default();
		self.as_url().hash(&mut h);
		h.finish_128()
	}
}
Repository: sxyazi/yazi
File: yazi-plugin/preset/plugins/file.lua (Lua)

Code before:
	local previewer = rt.plugin.previewer(job.file, job.mime)
	local fetchers = rt.plugin.fetchers(job.file, job.mime)
	local preloaders = rt.plugin.preloaders(job.file, job.mime)

	for i, v in ipairs(fetchers) do
		fetchers[i] = v.cmd
	end
	for i, v in ipairs(preloaders) do
		preloaders[i] = v.cmd
	end

	return {
		ui.Row({ "Base" }):style(ui.Style():fg("green")),
		ui.Row { "  Created:", cha.btime and os.date("%y/%m/%d %H:%M", math.floor(cha.btime)) or "-" },
		ui.Row { "  Modified:", cha.mtime and os.date("%y/%m/%d %H:%M", math.floor(cha.mtime)) or "-" },
		ui.Row { "  Mimetype:", job.mime },
		ui.Row {},

		ui.Row({ "Plugins" }):style(ui.Style():fg("green")),
		ui.Row { "  Spotter:", spotter and spotter.cmd or "-" },
		ui.Row { "  Previewer:", previewer and previewer.cmd or "-" },
		ui.Row { "  Fetchers:", #fetchers ~= 0 and fetchers or "-" },
		ui.Row { "  Preloaders:", #preloaders ~= 0 and preloaders or "-" },
	}
end

return M


Review comment (suggestion):
The change from string labels with arrays to Row height properties changes the display behavior. The original code displayed the array as a single row, while the new code attempts to set row height equal to array length. This may not produce the intended visual output if Row height doesn't support dynamic content spanning. Verify that :height() works as expected with multi-item arrays.
```suggestion
		ui.Row { "  Fetchers:", table.concat(fetchers, "\n") },
		ui.Row { "  Preloaders:", table.concat(preloaders, "\n") },
```

Code after:
	local previewer = rt.plugin.previewer(job.file, job.mime)
	local fetchers = rt.plugin.fetchers(job.file, job.mime)
	local preloaders = rt.plugin.preloaders(job.file, job.mime)

	for i, v in ipairs(fetchers) do
		fetchers[i] = v.cmd
	end
	fetchers = #fetchers ~= 0 and fetchers or { "-" }

	for i, v in ipairs(preloaders) do
		preloaders[i] = v.cmd
	end
	preloaders = #preloaders ~= 0 and preloaders or { "-" }

	return {
		ui.Row({ "Base" }):style(ui.Style():fg("green")),
		ui.Row { "  Created:", cha.btime and os.date("%y/%m/%d %H:%M", math.floor(cha.btime)) or "-" },
		ui.Row { "  Modified:", cha.mtime and os.date("%y/%m/%d %H:%M", math.floor(cha.mtime)) or "-" },
		ui.Row { "  Mimetype:", job.mime },
		ui.Row {},

		ui.Row({ "Plugins" }):style(ui.Style():fg("green")),
		ui.Row { "  Spotter:", spotter and spotter.cmd or "-" },
		ui.Row { "  Previewer:", previewer and previewer.cmd or "-" },
		ui.Row({ "  Fetchers:", fetchers }):height(#fetchers),
		ui.Row({ "  Preloaders:", preloaders }):height(#preloaders),
	}
end

return M
Repository: sxyazi/yazi
File: yazi-config/src/pattern.rs (Rust)

Code before:
	is_star:    bool,
	#[cfg(windows)]
	sep_lit:    bool,
}

impl Pattern {
	pub fn match_url(&self, url: impl AsUrl, is_dir: bool) -> bool {
		let url = url.as_url();

		if is_dir != self.is_dir {
			return false;
		} else if self.is_star {
			return true;
		} else if !self.scheme.matches(url.scheme) {
			return false;
		}

		#[cfg(unix)]
		let path = &url.loc;

		#[cfg(windows)]
		let path = if self.sep_lit {
			yazi_fs::path::backslash_to_slash(&url.loc)
		} else {
			std::borrow::Cow::Borrowed(url.loc.as_path())
		};

		self.inner.is_match(path)
	}

	pub fn match_mime(&self, mime: impl AsRef<str>) -> bool {
		self.is_star || (!mime.as_ref().is_empty() && self.inner.is_match(mime.as_ref()))
	}

	#[inline]
	pub fn any_file(&self) -> bool { self.is_star && !self.is_dir }

	#[inline]
	pub fn any_dir(&self) -> bool { self.is_star && self.is_dir }
}

impl FromStr for Pattern {
	type Err = anyhow::Error;

	fn from_str(s: &str) -> Result<Self, Self::Err> {
		// Trim leading case-sensitive indicator
		let a = s.trim_start_matches(r"\s");

		// Parse the URL scheme if present
		let (scheme, skip) = PatternScheme::parse(a)?;
		let b = &a[skip..];

Review comment (suggestion):
The reordering of conditional checks moves the scheme check before the is_star check. This changes the evaluation order where is_star patterns now respect scheme constraints. While this appears intentional for the PR's scheme filtering logic, ensure this doesn't break existing patterns that relied on is_star bypassing scheme checks.
```suggestion
		} else if self.is_star {
			return true;
		} else if !self.scheme.matches(url.scheme) {
			return false;
```

Code after:
	is_star:    bool,
	#[cfg(windows)]
	sep_lit:    bool,
}

impl Debug for Pattern {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		f.debug_struct("Pattern")
			.field("regex", &self.inner.glob().regex())
			.field("scheme", &self.scheme)
			.field("is_dir", &self.is_dir)
			.field("is_star", &self.is_star)
			.finish()
	}
}

impl Pattern {
	pub fn match_url(&self, url: impl AsUrl, is_dir: bool) -> bool {
		let url = url.as_url();

		if is_dir != self.is_dir {
			return false;
		} else if !self.scheme.matches(url.scheme) {
			return false;
		} else if self.is_star {
			return true;
		}

		#[cfg(unix)]
		let path = &url.loc;

		#[cfg(windows)]
		let path = if self.sep_lit {
			yazi_fs::path::backslash_to_slash(&url.loc)
		} else {
			std::borrow::Cow::Borrowed(url.loc.as_path())
		};

		self.inner.is_match(path)
	}

	pub fn match_mime(&self, mime: impl AsRef<str>) -> bool {
		self.is_star || (!mime.as_ref().is_empty() && self.inner.is_match(mime.as_ref()))
	}

	#[inline]
	pub fn any_file(&self) -> bool { self.is_star && !self.is_dir }

	#[inline]
	pub fn any_dir(&self) -> bool { self.is_star && self.is_dir }
}
Repository: sxyazi/yazi
File: yazi-shared/src/event/cmd.rs (Rust)

Code before:

	// Parse
	pub fn parse_args(
		words: impl Iterator<Item = String>,
		last: Option<String>,
		obase: bool,
	) -> Result<HashMap<DataKey, Data>> {
		let mut i = 0i64;
		words
			.into_iter()
			.map(|s| (s, true))
			.chain(last.into_iter().map(|s| (s, false)))
			.map(|(word, normal)| {
				let Some(arg) = word.strip_prefix("--").filter(|_| normal) else {
					i += 1;
					return Ok((DataKey::Integer(i - obase as i64), Data::String(word.into())));
				};

				let mut parts = arg.splitn(2, '=');
				let Some(key) = parts.next().map(|s| s.to_owned()) else {
					bail!("invalid argument: {arg}");
				};

				let val = if let Some(val) = parts.next() {
					Data::String(val.to_owned().into())
				} else {
					Data::Boolean(true)
				};

				Ok((DataKey::String(Cow::Owned(key)), val))
			})
			.collect()
	}
}

impl Display for Cmd {
	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
		write!(f, "{}", self.name)?;
		for (k, v) in &self.args {
			match k {
				DataKey::Integer(_) => {
					if let Some(s) = v.as_str() {
						write!(f, " {s}")?;
					}
				}
				DataKey::String(k) => {
					if v.try_into().is_ok_and(|b| b) {
						write!(f, " --{k}")?;
					} else if let Some(s) = v.as_str() {
						write!(f, " --{k}={s}")?;
					}

Review comment (suggestion):
The error message shows `{arg:?}` but `arg` is a `&[u8]` after `strip_prefix`. This will display the raw byte array format instead of attempting to show what the invalid UTF-8 sequence might look like. Consider using `String::from_utf8_lossy(arg)` in the error message to provide more readable output.
```suggestion
					bail!("argument key must be valid UTF-8: {}", String::from_utf8_lossy(arg));
```

Code after:

	// Parse
	pub fn parse_args<I>(
		words: I,
		last: Option<String>,
		obase: bool,
	) -> Result<HashMap<DataKey, Data>>
	where
		I: Iterator,
		I::Item: Into<OsString>,
	{
		let mut i = 0i64;
		words
			.into_iter()
			.map(|s| (s.into(), true))
			.chain(last.into_iter().map(|s| (s.into(), false)))
			.map(|(word, normal)| {
				let bytes = word.into_encoded_bytes();
				let Some(arg) = bytes.strip_prefix(b"--").filter(|_| normal) else {
					i += 1;
					return Ok((DataKey::Integer(i - obase as i64), bytes.into()));
				};

				let mut parts = arg.splitn(2, |&b| b == b'=');
				let Some(Ok(key)) = parts.next().map(str::from_utf8) else {
					bail!("argument key must be valid UTF-8: {arg:?}");
				};

				let val = parts.next().map_or(Data::Boolean(true), Data::from);
				Ok((DataKey::from(key.to_owned()), val))
			})
			.collect()
	}
}

impl Display for Cmd {
	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
		write!(f, "{}", self.name)?;
		for (k, v) in &self.args {
			match k {
				DataKey::Integer(_) => {
					if let Some(s) = v.as_str() {
						write!(f, " {s}")?;
					}
				}
				DataKey::String(k) => {
					if v.try_into().is_ok_and(|b| b) {
						write!(f, " --{k}")?;
					} else if let Some(s) = v.as_str() {
						write!(f, " --{k}={s}")?;
					}
Repository: sxyazi/yazi
File: yazi-shared/src/path/dyn.rs (Rust)

Code before:
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum PathDyn<'p> {
	Os(&'p std::path::Path),
}

#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum PathBufDyn {
	Os(std::path::PathBuf),
}


Review comment (bug):
The `PathBufDyn` type implements `PathBufLike` but lacks a `Default` implementation. Since `LocBuf<P>` derives `Default` and can be used with any `PathBufLike` type (line 7-8 in `yazi-shared/src/loc/buf.rs`), attempting to use `LocBuf<PathBufDyn>::default()` will fail to compile. Either add `impl Default for PathBufDyn` or ensure this type is never used with `LocBuf`'s default.

Code after:

	fn strip_prefix<'a, T>(self, base: T) -> Option<Self>
	where
		T: AsPathView<'a, Self::View<'a>>,
	{
		Some(match (self, base.as_path_view()) {
			(Self::Os(p), PathDyn::Os(q)) => Self::Os(p.strip_prefix(q).ok()?),
		})
	}
}

#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum PathBufDyn {
	Os(std::path::PathBuf),
}

impl PathBufLike for PathBufDyn {
	type Borrowed<'a> = PathDyn<'a>;
	type Inner = Vec<u8>;
	type InnerRef<'a> = &'a [u8];

	fn encoded_bytes(&self) -> &[u8] {
		match self {
			Self::Os(p) => p.as_os_str().as_encoded_bytes(),
		}
	}

	// FIXME: remove
	unsafe fn from_encoded_bytes(bytes: Vec<u8>) -> Self {
		Self::Os(std::path::PathBuf::from(unsafe {
			std::ffi::OsString::from_encoded_bytes_unchecked(bytes)
		}))
	}

	fn into_encoded_bytes(self) -> Vec<u8> {
		match self {
			Self::Os(p) => p.into_os_string().into_encoded_bytes(),
		}
	}

	fn set_file_name<T>(&mut self, name: T)
	where
		T: for<'a> AsInnerView<'a, Self::InnerRef<'a>>,
	{
		// TODO: introduce a new `PathInnerDyn`
		todo!()
	}

	fn take(&mut self) -> Self {
		match self {
			Self::Os(p) => Self::Os(std::mem::take(p)),
Repository: sxyazi/yazi
File: yazi-shared/src/path/dyn.rs (Rust)

Code before:
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum PathDyn<'p> {
	Os(&'p std::path::Path),
}

#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum PathBufDyn {
	Os(std::path::PathBuf),
}


Review comment (suggestion):
The `set_file_name` method is unimplemented and will panic at runtime if called. This is a critical issue since `PathBufLike` is a public trait and `set_file_name` is part of its contract. Consider either implementing this method or marking the trait/type as experimental until fully implemented.
```suggestion
		match self {
			Self::Os(p) => {
				let bytes = name.as_inner_view();
				// SAFETY: We assume bytes is a valid OsStr encoding
				let os_str = unsafe { std::ffi::OsStr::from_encoded_bytes_unchecked(bytes) };
				p.set_file_name(os_str);
			}
		}
```

Code after:

	fn encoded_bytes(&self) -> &[u8] {
		match self {
			Self::Os(p) => p.as_os_str().as_encoded_bytes(),
		}
	}

	// FIXME: remove
	unsafe fn from_encoded_bytes(bytes: Vec<u8>) -> Self {
		Self::Os(std::path::PathBuf::from(unsafe {
			std::ffi::OsString::from_encoded_bytes_unchecked(bytes)
		}))
	}

	fn into_encoded_bytes(self) -> Vec<u8> {
		match self {
			Self::Os(p) => p.into_os_string().into_encoded_bytes(),
		}
	}

	fn set_file_name<T>(&mut self, name: T)
	where
		T: for<'a> AsInnerView<'a, Self::InnerRef<'a>>,
	{
		// TODO: introduce a new `PathInnerDyn`
		todo!()
	}

	fn take(&mut self) -> Self {
		match self {
			Self::Os(p) => Self::Os(std::mem::take(p)),
		}
	}
}