diff --git a/src/features.rs b/src/features.rs index a85e0792..5e6fa65a 100644 --- a/src/features.rs +++ b/src/features.rs @@ -1,6 +1,6 @@ use std::{ collections::{BTreeMap, BTreeSet}, - slice, + fmt, slice, }; use crate::{manifest::Manifest, metadata::Metadata, PackageId}; @@ -87,7 +87,6 @@ impl Features { } /// The representation of Cargo feature. -#[derive(Debug)] pub(crate) enum Feature { /// A feature of the current crate. Normal { @@ -110,6 +109,20 @@ pub(crate) enum Feature { }, } +impl fmt::Debug for Feature { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + use fmt::Write; + match self { + Self::Normal { name } | Self::Path { name, .. } => f.write_str(name), + Self::Group { name, .. } => { + f.write_char('[')?; + f.write_str(name)?; + f.write_char(']') + } + } + } +} + impl Feature { pub(crate) fn group(group: impl IntoIterator>) -> Self { let list: Vec<_> = group.into_iter().map(Into::into).collect();