mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-22 11:34:09 +00:00
additional use of Self, remove * and & where not needed (#15091)
continuation of #15074.
This commit is contained in:
parent
bda9ea957a
commit
3d3856ffd5
14 changed files with 71 additions and 71 deletions
|
@ -51,7 +51,7 @@ impl Reinstall {
|
||||||
|
|
||||||
/// Returns `true` if the specified package should be reinstalled.
|
/// Returns `true` if the specified package should be reinstalled.
|
||||||
pub fn contains_package(&self, package_name: &PackageName) -> bool {
|
pub fn contains_package(&self, package_name: &PackageName) -> bool {
|
||||||
match &self {
|
match self {
|
||||||
Self::None => false,
|
Self::None => false,
|
||||||
Self::All => true,
|
Self::All => true,
|
||||||
Self::Packages(packages, ..) => packages.contains(package_name),
|
Self::Packages(packages, ..) => packages.contains(package_name),
|
||||||
|
@ -60,7 +60,7 @@ impl Reinstall {
|
||||||
|
|
||||||
/// Returns `true` if the specified path should be reinstalled.
|
/// Returns `true` if the specified path should be reinstalled.
|
||||||
pub fn contains_path(&self, path: &Path) -> bool {
|
pub fn contains_path(&self, path: &Path) -> bool {
|
||||||
match &self {
|
match self {
|
||||||
Self::None => false,
|
Self::None => false,
|
||||||
Self::All => true,
|
Self::All => true,
|
||||||
Self::Packages(.., paths) => paths
|
Self::Packages(.., paths) => paths
|
||||||
|
@ -194,7 +194,7 @@ impl Upgrade {
|
||||||
|
|
||||||
/// Returns `true` if the specified package should be upgraded.
|
/// Returns `true` if the specified package should be upgraded.
|
||||||
pub fn contains(&self, package_name: &PackageName) -> bool {
|
pub fn contains(&self, package_name: &PackageName) -> bool {
|
||||||
match &self {
|
match self {
|
||||||
Self::None => false,
|
Self::None => false,
|
||||||
Self::All => true,
|
Self::All => true,
|
||||||
Self::Packages(packages) => packages.contains_key(package_name),
|
Self::Packages(packages) => packages.contains_key(package_name),
|
||||||
|
|
|
@ -97,8 +97,8 @@ impl FileLocation {
|
||||||
/// example, the location is a path and the path isn't valid UTF-8.
|
/// example, the location is a path and the path isn't valid UTF-8.
|
||||||
/// (Because URLs must be valid UTF-8.)
|
/// (Because URLs must be valid UTF-8.)
|
||||||
pub fn to_url(&self) -> Result<DisplaySafeUrl, ToUrlError> {
|
pub fn to_url(&self) -> Result<DisplaySafeUrl, ToUrlError> {
|
||||||
match *self {
|
match self {
|
||||||
Self::RelativeUrl(ref base, ref path) => {
|
Self::RelativeUrl(base, path) => {
|
||||||
let base_url =
|
let base_url =
|
||||||
DisplaySafeUrl::parse(base).map_err(|err| ToUrlError::InvalidBase {
|
DisplaySafeUrl::parse(base).map_err(|err| ToUrlError::InvalidBase {
|
||||||
base: base.to_string(),
|
base: base.to_string(),
|
||||||
|
@ -111,7 +111,7 @@ impl FileLocation {
|
||||||
})?;
|
})?;
|
||||||
Ok(joined)
|
Ok(joined)
|
||||||
}
|
}
|
||||||
Self::AbsoluteUrl(ref absolute) => absolute.to_url(),
|
Self::AbsoluteUrl(absolute) => absolute.to_url(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ impl Deref for IndexUrl {
|
||||||
type Target = Url;
|
type Target = Url;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
match &self {
|
match self {
|
||||||
Self::Pypi(url) => url,
|
Self::Pypi(url) => url,
|
||||||
Self::Url(url) => url,
|
Self::Url(url) => url,
|
||||||
Self::Path(url) => url,
|
Self::Path(url) => url,
|
||||||
|
|
|
@ -620,15 +620,15 @@ impl PrioritizedDist {
|
||||||
impl<'a> CompatibleDist<'a> {
|
impl<'a> CompatibleDist<'a> {
|
||||||
/// Return the [`ResolvedDistRef`] to use during resolution.
|
/// Return the [`ResolvedDistRef`] to use during resolution.
|
||||||
pub fn for_resolution(&self) -> ResolvedDistRef<'a> {
|
pub fn for_resolution(&self) -> ResolvedDistRef<'a> {
|
||||||
match *self {
|
match self {
|
||||||
CompatibleDist::InstalledDist(dist) => ResolvedDistRef::Installed { dist },
|
Self::InstalledDist(dist) => ResolvedDistRef::Installed { dist },
|
||||||
CompatibleDist::SourceDist { sdist, prioritized } => {
|
Self::SourceDist { sdist, prioritized } => {
|
||||||
ResolvedDistRef::InstallableRegistrySourceDist { sdist, prioritized }
|
ResolvedDistRef::InstallableRegistrySourceDist { sdist, prioritized }
|
||||||
}
|
}
|
||||||
CompatibleDist::CompatibleWheel {
|
Self::CompatibleWheel {
|
||||||
wheel, prioritized, ..
|
wheel, prioritized, ..
|
||||||
} => ResolvedDistRef::InstallableRegistryBuiltDist { wheel, prioritized },
|
} => ResolvedDistRef::InstallableRegistryBuiltDist { wheel, prioritized },
|
||||||
CompatibleDist::IncompatibleWheel {
|
Self::IncompatibleWheel {
|
||||||
wheel, prioritized, ..
|
wheel, prioritized, ..
|
||||||
} => ResolvedDistRef::InstallableRegistryBuiltDist { wheel, prioritized },
|
} => ResolvedDistRef::InstallableRegistryBuiltDist { wheel, prioritized },
|
||||||
}
|
}
|
||||||
|
@ -636,15 +636,15 @@ impl<'a> CompatibleDist<'a> {
|
||||||
|
|
||||||
/// Return the [`ResolvedDistRef`] to use during installation.
|
/// Return the [`ResolvedDistRef`] to use during installation.
|
||||||
pub fn for_installation(&self) -> ResolvedDistRef<'a> {
|
pub fn for_installation(&self) -> ResolvedDistRef<'a> {
|
||||||
match *self {
|
match self {
|
||||||
CompatibleDist::InstalledDist(dist) => ResolvedDistRef::Installed { dist },
|
Self::InstalledDist(dist) => ResolvedDistRef::Installed { dist },
|
||||||
CompatibleDist::SourceDist { sdist, prioritized } => {
|
Self::SourceDist { sdist, prioritized } => {
|
||||||
ResolvedDistRef::InstallableRegistrySourceDist { sdist, prioritized }
|
ResolvedDistRef::InstallableRegistrySourceDist { sdist, prioritized }
|
||||||
}
|
}
|
||||||
CompatibleDist::CompatibleWheel {
|
Self::CompatibleWheel {
|
||||||
wheel, prioritized, ..
|
wheel, prioritized, ..
|
||||||
} => ResolvedDistRef::InstallableRegistryBuiltDist { wheel, prioritized },
|
} => ResolvedDistRef::InstallableRegistryBuiltDist { wheel, prioritized },
|
||||||
CompatibleDist::IncompatibleWheel {
|
Self::IncompatibleWheel {
|
||||||
sdist, prioritized, ..
|
sdist, prioritized, ..
|
||||||
} => ResolvedDistRef::InstallableRegistrySourceDist { sdist, prioritized },
|
} => ResolvedDistRef::InstallableRegistrySourceDist { sdist, prioritized },
|
||||||
}
|
}
|
||||||
|
|
|
@ -571,7 +571,7 @@ impl RequirementSource {
|
||||||
|
|
||||||
/// Convert the source to a [`VerbatimParsedUrl`], if it's a URL source.
|
/// Convert the source to a [`VerbatimParsedUrl`], if it's a URL source.
|
||||||
pub fn to_verbatim_parsed_url(&self) -> Option<VerbatimParsedUrl> {
|
pub fn to_verbatim_parsed_url(&self) -> Option<VerbatimParsedUrl> {
|
||||||
match &self {
|
match self {
|
||||||
Self::Registry { .. } => None,
|
Self::Registry { .. } => None,
|
||||||
Self::Url {
|
Self::Url {
|
||||||
location,
|
location,
|
||||||
|
|
|
@ -164,7 +164,7 @@ impl PortableGlobParser {
|
||||||
}
|
}
|
||||||
start_or_slash = false;
|
start_or_slash = false;
|
||||||
} else if c == '\\' {
|
} else if c == '\\' {
|
||||||
match *self {
|
match self {
|
||||||
Self::Pep639 => {
|
Self::Pep639 => {
|
||||||
return Err(PortableGlobError::InvalidBackslash {
|
return Err(PortableGlobError::InvalidBackslash {
|
||||||
glob: glob.to_string(),
|
glob: glob.to_string(),
|
||||||
|
@ -194,7 +194,7 @@ impl PortableGlobParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let err = match *self {
|
let err = match self {
|
||||||
Self::Pep639 => PortableGlobError::InvalidCharacter {
|
Self::Pep639 => PortableGlobError::InvalidCharacter {
|
||||||
glob: glob.to_string(),
|
glob: glob.to_string(),
|
||||||
pos,
|
pos,
|
||||||
|
|
|
@ -2405,9 +2405,9 @@ impl ReleaseNumbers {
|
||||||
|
|
||||||
/// Returns the release components as a slice.
|
/// Returns the release components as a slice.
|
||||||
fn as_slice(&self) -> &[u64] {
|
fn as_slice(&self) -> &[u64] {
|
||||||
match *self {
|
match self {
|
||||||
Self::Inline { ref numbers, len } => &numbers[..len],
|
Self::Inline { numbers, len } => &numbers[..*len],
|
||||||
Self::Vec(ref vec) => vec,
|
Self::Vec(vec) => vec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -581,7 +581,7 @@ impl ExtraOperator {
|
||||||
|
|
||||||
/// Negates this operator.
|
/// Negates this operator.
|
||||||
pub(crate) fn negate(&self) -> Self {
|
pub(crate) fn negate(&self) -> Self {
|
||||||
match *self {
|
match self {
|
||||||
Self::Equal => Self::NotEqual,
|
Self::Equal => Self::NotEqual,
|
||||||
Self::NotEqual => Self::Equal,
|
Self::NotEqual => Self::Equal,
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ pub enum Os {
|
||||||
|
|
||||||
impl fmt::Display for Os {
|
impl fmt::Display for Os {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match *self {
|
match self {
|
||||||
Self::Manylinux { .. } => write!(f, "manylinux"),
|
Self::Manylinux { .. } => write!(f, "manylinux"),
|
||||||
Self::Musllinux { .. } => write!(f, "musllinux"),
|
Self::Musllinux { .. } => write!(f, "musllinux"),
|
||||||
Self::Windows => write!(f, "windows"),
|
Self::Windows => write!(f, "windows"),
|
||||||
|
|
|
@ -450,8 +450,8 @@ impl ConflictPackage {
|
||||||
/// If this conflict corresponds to an extra, then return the
|
/// If this conflict corresponds to an extra, then return the
|
||||||
/// extra name.
|
/// extra name.
|
||||||
pub fn extra(&self) -> Option<&ExtraName> {
|
pub fn extra(&self) -> Option<&ExtraName> {
|
||||||
match *self {
|
match self {
|
||||||
Self::Extra(ref extra) => Some(extra),
|
Self::Extra(extra) => Some(extra),
|
||||||
Self::Group(_) => None,
|
Self::Group(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,17 +459,17 @@ impl ConflictPackage {
|
||||||
/// If this conflict corresponds to a group, then return the
|
/// If this conflict corresponds to a group, then return the
|
||||||
/// group name.
|
/// group name.
|
||||||
pub fn group(&self) -> Option<&GroupName> {
|
pub fn group(&self) -> Option<&GroupName> {
|
||||||
match *self {
|
match self {
|
||||||
Self::Group(ref group) => Some(group),
|
Self::Group(group) => Some(group),
|
||||||
Self::Extra(_) => None,
|
Self::Extra(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns this conflict as a new type with its fields borrowed.
|
/// Returns this conflict as a new type with its fields borrowed.
|
||||||
pub fn as_ref(&self) -> ConflictPackageRef<'_> {
|
pub fn as_ref(&self) -> ConflictPackageRef<'_> {
|
||||||
match *self {
|
match self {
|
||||||
Self::Extra(ref extra) => ConflictPackageRef::Extra(extra),
|
Self::Extra(extra) => ConflictPackageRef::Extra(extra),
|
||||||
Self::Group(ref group) => ConflictPackageRef::Group(group),
|
Self::Group(group) => ConflictPackageRef::Group(group),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -487,39 +487,39 @@ impl<'a> ConflictPackageRef<'a> {
|
||||||
/// If this conflict corresponds to an extra, then return the
|
/// If this conflict corresponds to an extra, then return the
|
||||||
/// extra name.
|
/// extra name.
|
||||||
pub fn extra(&self) -> Option<&'a ExtraName> {
|
pub fn extra(&self) -> Option<&'a ExtraName> {
|
||||||
match *self {
|
match self {
|
||||||
ConflictPackageRef::Extra(extra) => Some(extra),
|
Self::Extra(extra) => Some(extra),
|
||||||
ConflictPackageRef::Group(_) => None,
|
Self::Group(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If this conflict corresponds to a group, then return the
|
/// If this conflict corresponds to a group, then return the
|
||||||
/// group name.
|
/// group name.
|
||||||
pub fn group(&self) -> Option<&'a GroupName> {
|
pub fn group(&self) -> Option<&'a GroupName> {
|
||||||
match *self {
|
match self {
|
||||||
ConflictPackageRef::Group(group) => Some(group),
|
Self::Group(group) => Some(group),
|
||||||
ConflictPackageRef::Extra(_) => None,
|
Self::Extra(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts this borrowed conflict to its owned variant.
|
/// Converts this borrowed conflict to its owned variant.
|
||||||
pub fn to_owned(&self) -> ConflictPackage {
|
pub fn to_owned(&self) -> ConflictPackage {
|
||||||
match *self {
|
match *self {
|
||||||
ConflictPackageRef::Extra(extra) => ConflictPackage::Extra(extra.clone()),
|
Self::Extra(extra) => ConflictPackage::Extra(extra.clone()),
|
||||||
ConflictPackageRef::Group(group) => ConflictPackage::Group(group.clone()),
|
Self::Group(group) => ConflictPackage::Group(group.clone()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a ExtraName> for ConflictPackageRef<'a> {
|
impl<'a> From<&'a ExtraName> for ConflictPackageRef<'a> {
|
||||||
fn from(extra: &'a ExtraName) -> Self {
|
fn from(extra: &'a ExtraName) -> Self {
|
||||||
ConflictPackageRef::Extra(extra)
|
Self::Extra(extra)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a GroupName> for ConflictPackageRef<'a> {
|
impl<'a> From<&'a GroupName> for ConflictPackageRef<'a> {
|
||||||
fn from(group: &'a GroupName) -> Self {
|
fn from(group: &'a GroupName) -> Self {
|
||||||
ConflictPackageRef::Group(group)
|
Self::Group(group)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ impl Display for RequirementsTxtParserError {
|
||||||
|
|
||||||
impl std::error::Error for RequirementsTxtParserError {
|
impl std::error::Error for RequirementsTxtParserError {
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||||
match &self {
|
match self {
|
||||||
Self::Io(err) => err.source(),
|
Self::Io(err) => err.source(),
|
||||||
Self::Url { source, .. } => Some(source),
|
Self::Url { source, .. } => Some(source),
|
||||||
Self::FileUrl { .. } => None,
|
Self::FileUrl { .. } => None,
|
||||||
|
|
|
@ -3540,7 +3540,7 @@ impl Source {
|
||||||
|
|
||||||
/// Returns `true` if the source is that of a wheel.
|
/// Returns `true` if the source is that of a wheel.
|
||||||
fn is_wheel(&self) -> bool {
|
fn is_wheel(&self) -> bool {
|
||||||
match &self {
|
match self {
|
||||||
Self::Path(path) => {
|
Self::Path(path) => {
|
||||||
matches!(
|
matches!(
|
||||||
DistExtension::from_path(path).ok(),
|
DistExtension::from_path(path).ok(),
|
||||||
|
@ -3579,8 +3579,8 @@ impl Source {
|
||||||
|
|
||||||
fn to_toml(&self, table: &mut Table) {
|
fn to_toml(&self, table: &mut Table) {
|
||||||
let mut source_table = InlineTable::new();
|
let mut source_table = InlineTable::new();
|
||||||
match *self {
|
match self {
|
||||||
Self::Registry(ref source) => match source {
|
Self::Registry(source) => match source {
|
||||||
RegistrySource::Url(url) => {
|
RegistrySource::Url(url) => {
|
||||||
source_table.insert("registry", Value::from(url.as_ref()));
|
source_table.insert("registry", Value::from(url.as_ref()));
|
||||||
}
|
}
|
||||||
|
@ -3591,10 +3591,10 @@ impl Source {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Self::Git(ref url, _) => {
|
Self::Git(url, _) => {
|
||||||
source_table.insert("git", Value::from(url.as_ref()));
|
source_table.insert("git", Value::from(url.as_ref()));
|
||||||
}
|
}
|
||||||
Self::Direct(ref url, DirectSource { ref subdirectory }) => {
|
Self::Direct(url, DirectSource { subdirectory }) => {
|
||||||
source_table.insert("url", Value::from(url.as_ref()));
|
source_table.insert("url", Value::from(url.as_ref()));
|
||||||
if let Some(ref subdirectory) = *subdirectory {
|
if let Some(ref subdirectory) = *subdirectory {
|
||||||
source_table.insert(
|
source_table.insert(
|
||||||
|
@ -3603,22 +3603,22 @@ impl Source {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::Path(ref path) => {
|
Self::Path(path) => {
|
||||||
source_table.insert("path", Value::from(PortablePath::from(path).to_string()));
|
source_table.insert("path", Value::from(PortablePath::from(path).to_string()));
|
||||||
}
|
}
|
||||||
Self::Directory(ref path) => {
|
Self::Directory(path) => {
|
||||||
source_table.insert(
|
source_table.insert(
|
||||||
"directory",
|
"directory",
|
||||||
Value::from(PortablePath::from(path).to_string()),
|
Value::from(PortablePath::from(path).to_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Self::Editable(ref path) => {
|
Self::Editable(path) => {
|
||||||
source_table.insert(
|
source_table.insert(
|
||||||
"editable",
|
"editable",
|
||||||
Value::from(PortablePath::from(path).to_string()),
|
Value::from(PortablePath::from(path).to_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Self::Virtual(ref path) => {
|
Self::Virtual(path) => {
|
||||||
source_table.insert("virtual", Value::from(PortablePath::from(path).to_string()));
|
source_table.insert("virtual", Value::from(PortablePath::from(path).to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3645,7 +3645,7 @@ impl Display for Source {
|
||||||
|
|
||||||
impl Source {
|
impl Source {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
match *self {
|
match self {
|
||||||
Self::Registry(..) => "registry",
|
Self::Registry(..) => "registry",
|
||||||
Self::Git(..) => "git",
|
Self::Git(..) => "git",
|
||||||
Self::Direct(..) => "direct",
|
Self::Direct(..) => "direct",
|
||||||
|
@ -3664,7 +3664,7 @@ impl Source {
|
||||||
///
|
///
|
||||||
/// Returns `None` to indicate that the source kind _may_ include a hash.
|
/// Returns `None` to indicate that the source kind _may_ include a hash.
|
||||||
fn requires_hash(&self) -> Option<bool> {
|
fn requires_hash(&self) -> Option<bool> {
|
||||||
match *self {
|
match self {
|
||||||
Self::Registry(..) => None,
|
Self::Registry(..) => None,
|
||||||
Self::Direct(..) | Self::Path(..) => Some(true),
|
Self::Direct(..) | Self::Path(..) => Some(true),
|
||||||
Self::Git(..) | Self::Directory(..) | Self::Editable(..) | Self::Virtual(..) => {
|
Self::Git(..) | Self::Directory(..) | Self::Editable(..) | Self::Virtual(..) => {
|
||||||
|
@ -3927,7 +3927,7 @@ impl SourceDist {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn url(&self) -> Option<&UrlString> {
|
fn url(&self) -> Option<&UrlString> {
|
||||||
match &self {
|
match self {
|
||||||
Self::Metadata { .. } => None,
|
Self::Metadata { .. } => None,
|
||||||
Self::Url { url, .. } => Some(url),
|
Self::Url { url, .. } => Some(url),
|
||||||
Self::Path { .. } => None,
|
Self::Path { .. } => None,
|
||||||
|
@ -3935,7 +3935,7 @@ impl SourceDist {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn hash(&self) -> Option<&Hash> {
|
pub(crate) fn hash(&self) -> Option<&Hash> {
|
||||||
match &self {
|
match self {
|
||||||
Self::Metadata { metadata } => metadata.hash.as_ref(),
|
Self::Metadata { metadata } => metadata.hash.as_ref(),
|
||||||
Self::Url { metadata, .. } => metadata.hash.as_ref(),
|
Self::Url { metadata, .. } => metadata.hash.as_ref(),
|
||||||
Self::Path { metadata, .. } => metadata.hash.as_ref(),
|
Self::Path { metadata, .. } => metadata.hash.as_ref(),
|
||||||
|
@ -3943,7 +3943,7 @@ impl SourceDist {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn size(&self) -> Option<u64> {
|
pub(crate) fn size(&self) -> Option<u64> {
|
||||||
match &self {
|
match self {
|
||||||
Self::Metadata { metadata } => metadata.size,
|
Self::Metadata { metadata } => metadata.size,
|
||||||
Self::Url { metadata, .. } => metadata.size,
|
Self::Url { metadata, .. } => metadata.size,
|
||||||
Self::Path { metadata, .. } => metadata.size,
|
Self::Path { metadata, .. } => metadata.size,
|
||||||
|
@ -3951,7 +3951,7 @@ impl SourceDist {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn upload_time(&self) -> Option<Timestamp> {
|
pub(crate) fn upload_time(&self) -> Option<Timestamp> {
|
||||||
match &self {
|
match self {
|
||||||
Self::Metadata { metadata } => metadata.upload_time,
|
Self::Metadata { metadata } => metadata.upload_time,
|
||||||
Self::Url { metadata, .. } => metadata.upload_time,
|
Self::Url { metadata, .. } => metadata.upload_time,
|
||||||
Self::Path { metadata, .. } => metadata.upload_time,
|
Self::Path { metadata, .. } => metadata.upload_time,
|
||||||
|
@ -4169,7 +4169,7 @@ impl SourceDist {
|
||||||
/// Returns the TOML representation of this source distribution.
|
/// Returns the TOML representation of this source distribution.
|
||||||
fn to_toml(&self) -> Result<InlineTable, toml_edit::ser::Error> {
|
fn to_toml(&self) -> Result<InlineTable, toml_edit::ser::Error> {
|
||||||
let mut table = InlineTable::new();
|
let mut table = InlineTable::new();
|
||||||
match &self {
|
match self {
|
||||||
Self::Metadata { .. } => {}
|
Self::Metadata { .. } => {}
|
||||||
Self::Url { url, .. } => {
|
Self::Url { url, .. } => {
|
||||||
table.insert("url", Value::from(url.as_ref()));
|
table.insert("url", Value::from(url.as_ref()));
|
||||||
|
|
|
@ -74,9 +74,9 @@ impl ResolutionGraphNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn package_extra_names(&self) -> Option<(&PackageName, &ExtraName)> {
|
pub(crate) fn package_extra_names(&self) -> Option<(&PackageName, &ExtraName)> {
|
||||||
match *self {
|
match self {
|
||||||
Self::Root => None,
|
Self::Root => None,
|
||||||
Self::Dist(ref dist) => {
|
Self::Dist(dist) => {
|
||||||
let extra = dist.extra.as_ref()?;
|
let extra = dist.extra.as_ref()?;
|
||||||
Some((&dist.name, extra))
|
Some((&dist.name, extra))
|
||||||
}
|
}
|
||||||
|
@ -84,9 +84,9 @@ impl ResolutionGraphNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn package_group_names(&self) -> Option<(&PackageName, &GroupName)> {
|
pub(crate) fn package_group_names(&self) -> Option<(&PackageName, &GroupName)> {
|
||||||
match *self {
|
match self {
|
||||||
Self::Root => None,
|
Self::Root => None,
|
||||||
Self::Dist(ref dist) => {
|
Self::Dist(dist) => {
|
||||||
let group = dist.dev.as_ref()?;
|
let group = dist.dev.as_ref()?;
|
||||||
Some((&dist.name, group))
|
Some((&dist.name, group))
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,9 @@ impl ResolutionGraphNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn package_name(&self) -> Option<&PackageName> {
|
pub(crate) fn package_name(&self) -> Option<&PackageName> {
|
||||||
match *self {
|
match self {
|
||||||
Self::Root => None,
|
Self::Root => None,
|
||||||
Self::Dist(ref dist) => Some(&dist.name),
|
Self::Dist(dist) => Some(&dist.name),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,8 +588,8 @@ impl<'a> ParsedRawExtra<'a> {
|
||||||
name_error,
|
name_error,
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
match *self {
|
match self {
|
||||||
ParsedRawExtra::Extra { extra, .. } => {
|
Self::Extra { extra, .. } => {
|
||||||
let extra = ExtraName::from_str(extra).map_err(|name_error| {
|
let extra = ExtraName::from_str(extra).map_err(|name_error| {
|
||||||
ResolveError::InvalidValueInConflictMarker {
|
ResolveError::InvalidValueInConflictMarker {
|
||||||
kind: "extra",
|
kind: "extra",
|
||||||
|
@ -598,7 +598,7 @@ impl<'a> ParsedRawExtra<'a> {
|
||||||
})?;
|
})?;
|
||||||
Ok(ConflictItem::from((package, extra)))
|
Ok(ConflictItem::from((package, extra)))
|
||||||
}
|
}
|
||||||
ParsedRawExtra::Group { group, .. } => {
|
Self::Group { group, .. } => {
|
||||||
let group = GroupName::from_str(group).map_err(|name_error| {
|
let group = GroupName::from_str(group).map_err(|name_error| {
|
||||||
ResolveError::InvalidValueInConflictMarker {
|
ResolveError::InvalidValueInConflictMarker {
|
||||||
kind: "group",
|
kind: "group",
|
||||||
|
@ -611,9 +611,9 @@ impl<'a> ParsedRawExtra<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn package(&self) -> &'a str {
|
fn package(&self) -> &'a str {
|
||||||
match *self {
|
match self {
|
||||||
ParsedRawExtra::Extra { package, .. } => package,
|
Self::Extra { package, .. } => package,
|
||||||
ParsedRawExtra::Group { package, .. } => package,
|
Self::Group { package, .. } => package,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue