mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-22 12:35:36 +00:00
Fix some nightly lints (#15028)
Apply fixes for some `cargo check` and `cargo clippy` lints that are on in nightly Rust. The following command now passes, the blanket allows had to many false-positives: ``` cargo +nightly clippy -- -A clippy::doc_markdown -A mismatched_lifetime_syntaxes -A clippy::explicit_deref_methods ``` `cargo +nightly check -- -A mismatched_lifetime_syntaxes` now passes without warnings.
This commit is contained in:
parent
025d209735
commit
368b7b1e12
6 changed files with 43 additions and 51 deletions
|
|
@ -140,12 +140,10 @@ impl FromStr for LanguageTag {
|
||||||
Ok(Self::None)
|
Ok(Self::None)
|
||||||
} else if let Some(py) = s.strip_prefix("py") {
|
} else if let Some(py) = s.strip_prefix("py") {
|
||||||
match py.len() {
|
match py.len() {
|
||||||
0 => {
|
0 => Err(ParseLanguageTagError::MissingMajorVersion {
|
||||||
return Err(ParseLanguageTagError::MissingMajorVersion {
|
implementation: "Python",
|
||||||
implementation: "Python",
|
tag: s.to_string(),
|
||||||
tag: s.to_string(),
|
}),
|
||||||
});
|
|
||||||
}
|
|
||||||
1 => {
|
1 => {
|
||||||
// Ex) `py3`
|
// Ex) `py3`
|
||||||
let major = py
|
let major = py
|
||||||
|
|
|
||||||
|
|
@ -1606,7 +1606,7 @@ impl PylockTomlArchive {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(PylockTomlErrorKind::ArchiveMissingPathUrl(name.clone()));
|
Err(PylockTomlErrorKind::ArchiveMissingPathUrl(name.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1631,7 +1631,7 @@ impl PylockTomlArchive {
|
||||||
let ext = DistExtension::from_path(filename)?;
|
let ext = DistExtension::from_path(filename)?;
|
||||||
Ok(matches!(ext, DistExtension::Wheel))
|
Ok(matches!(ext, DistExtension::Wheel))
|
||||||
} else {
|
} else {
|
||||||
return Err(PylockTomlErrorKind::ArchiveMissingPathUrl(name.clone()));
|
Err(PylockTomlErrorKind::ArchiveMissingPathUrl(name.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::{BTreeMap, BTreeSet, VecDeque};
|
use std::collections::{BTreeMap, BTreeSet, VecDeque};
|
||||||
use std::convert::Infallible;
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt::{Debug, Display, Formatter};
|
use std::fmt::{Debug, Display, Formatter};
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
@ -3907,7 +3906,7 @@ struct SourceDistMetadata {
|
||||||
/// future, so this should be treated as only a hint to where to look
|
/// future, so this should be treated as only a hint to where to look
|
||||||
/// and/or recording where the source dist file originally came from.
|
/// and/or recording where the source dist file originally came from.
|
||||||
#[derive(Clone, Debug, serde::Deserialize, PartialEq, Eq)]
|
#[derive(Clone, Debug, serde::Deserialize, PartialEq, Eq)]
|
||||||
#[serde(try_from = "SourceDistWire")]
|
#[serde(from = "SourceDistWire")]
|
||||||
enum SourceDist {
|
enum SourceDist {
|
||||||
Url {
|
Url {
|
||||||
url: UrlString,
|
url: UrlString,
|
||||||
|
|
@ -4206,17 +4205,15 @@ impl SourceDist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<SourceDistWire> for SourceDist {
|
impl From<SourceDistWire> for SourceDist {
|
||||||
type Error = Infallible;
|
fn from(wire: SourceDistWire) -> SourceDist {
|
||||||
|
|
||||||
fn try_from(wire: SourceDistWire) -> Result<SourceDist, Infallible> {
|
|
||||||
match wire {
|
match wire {
|
||||||
SourceDistWire::Url { url, metadata } => Ok(SourceDist::Url { url, metadata }),
|
SourceDistWire::Url { url, metadata } => SourceDist::Url { url, metadata },
|
||||||
SourceDistWire::Path { path, metadata } => Ok(SourceDist::Path {
|
SourceDistWire::Path { path, metadata } => SourceDist::Path {
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
metadata,
|
metadata,
|
||||||
}),
|
},
|
||||||
SourceDistWire::Metadata { metadata } => Ok(SourceDist::Metadata { metadata }),
|
SourceDistWire::Metadata { metadata } => SourceDist::Metadata { metadata },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -523,39 +523,36 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Pick the next compatible version.
|
// Pick the next compatible version.
|
||||||
let version = match decision {
|
let Some(version) = decision else {
|
||||||
None => {
|
debug!("No compatible version found for: {next_package}");
|
||||||
debug!("No compatible version found for: {next_package}");
|
|
||||||
|
|
||||||
let term_intersection = state
|
let term_intersection = state
|
||||||
.pubgrub
|
.pubgrub
|
||||||
.partial_solution
|
.partial_solution
|
||||||
.term_intersection_for_package(next_id)
|
.term_intersection_for_package(next_id)
|
||||||
.expect("a package was chosen but we don't have a term");
|
.expect("a package was chosen but we don't have a term");
|
||||||
|
|
||||||
if let PubGrubPackageInner::Package { name, .. } = &**next_package {
|
if let PubGrubPackageInner::Package { name, .. } = &**next_package {
|
||||||
// Check if the decision was due to the package being unavailable
|
// Check if the decision was due to the package being unavailable
|
||||||
if let Some(entry) = self.unavailable_packages.get(name) {
|
if let Some(entry) = self.unavailable_packages.get(name) {
|
||||||
state.pubgrub.add_incompatibility(
|
state
|
||||||
Incompatibility::custom_term(
|
.pubgrub
|
||||||
next_id,
|
.add_incompatibility(Incompatibility::custom_term(
|
||||||
term_intersection.clone(),
|
next_id,
|
||||||
UnavailableReason::Package(entry.clone()),
|
term_intersection.clone(),
|
||||||
),
|
UnavailableReason::Package(entry.clone()),
|
||||||
);
|
));
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state
|
|
||||||
.pubgrub
|
|
||||||
.add_incompatibility(Incompatibility::no_versions(
|
|
||||||
next_id,
|
|
||||||
term_intersection.clone(),
|
|
||||||
));
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
Some(version) => version,
|
|
||||||
|
state
|
||||||
|
.pubgrub
|
||||||
|
.add_incompatibility(Incompatibility::no_versions(
|
||||||
|
next_id,
|
||||||
|
term_intersection.clone(),
|
||||||
|
));
|
||||||
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let version = match version {
|
let version = match version {
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ pub(crate) async fn sync(
|
||||||
});
|
});
|
||||||
|
|
||||||
match update_environment(
|
match update_environment(
|
||||||
Deref::deref(&environment).clone(),
|
environment.clone(),
|
||||||
spec,
|
spec,
|
||||||
modifications,
|
modifications,
|
||||||
build_constraints.unwrap_or_default(),
|
build_constraints.unwrap_or_default(),
|
||||||
|
|
|
||||||
|
|
@ -1437,9 +1437,9 @@ impl AddSettings {
|
||||||
|
|
||||||
// Warn user if an ambiguous relative path was passed as a value for
|
// Warn user if an ambiguous relative path was passed as a value for
|
||||||
// `--index` or `--default-index`.
|
// `--index` or `--default-index`.
|
||||||
indexes
|
for index in &indexes {
|
||||||
.iter()
|
index.url().warn_on_disambiguated_relative_path();
|
||||||
.for_each(|index| index.url().warn_on_disambiguated_relative_path());
|
}
|
||||||
|
|
||||||
// If the user passed an `--index-url` or `--extra-index-url`, warn.
|
// If the user passed an `--index-url` or `--extra-index-url`, warn.
|
||||||
if installer
|
if installer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue