Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ring = "0.17"
# PEM -> DER conversion
x509-parser = "0.15"
# Pubgrub dependency resolution algorithm
pubgrub = "0.2"
pubgrub = "0.3"
# Basic auth HTTP helper
http-auth-basic = "0.3"
# base16 encoding
Expand Down
27 changes: 2 additions & 25 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ fn proto_to_retirement_reason(reason: proto::package::RetirementReason) -> Retir
fn proto_to_dep(dep: proto::package::Dependency) -> Result<(String, Dependency), ApiError> {
let app = dep.app;
let repository = dep.repository;
let requirement = Range::new(dep.requirement);
let requirement = Range::new(dep.requirement.clone())
.map_err(|_| ApiError::InvalidVersionFormat(dep.requirement))?;
Ok((
dep.package,
Dependency {
Expand Down Expand Up @@ -856,10 +857,6 @@ impl<Meta> Release<Meta> {
pub fn is_retired(&self) -> bool {
self.retirement_status.is_some()
}

fn is_pre(&self) -> bool {
self.version.is_pre()
}
}

#[derive(Debug, PartialEq, Eq, Clone, serde::Deserialize)]
Expand Down Expand Up @@ -926,26 +923,6 @@ pub struct Dependency {
pub repository: Option<String>,
}

impl Dependency {
pub(crate) fn from_range(range: Range) -> Self {
Dependency {
app: None,
optional: false,
repository: None,
requirement: range,
}
}

pub(crate) fn from_version(version: &Version) -> Self {
Dependency {
app: None,
optional: false,
repository: None,
requirement: Range::new(version.to_string()),
}
}
}

static USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), " (", env!("CARGO_PKG_VERSION"), ")");

fn validate_package_and_version(package: &str, version: &str) -> Result<(), ApiError> {
Expand Down
4 changes: 2 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ async fn get_package_release_ok() {
(
"plug".into(),
Dependency {
requirement: Range::new("~>0.11.0".into()),
requirement: Range::new("~>0.11.0".into()).unwrap(),
optional: false,
app: Some("plug".into()),
repository: None
Expand All @@ -1230,7 +1230,7 @@ async fn get_package_release_ok() {
(
"cowboy".into(),
Dependency {
requirement: Range::new("~>1.0.0".into()),
requirement: Range::new("~>1.0.0".into()).unwrap(),
optional: false,
app: Some("cowboy".into()),
repository: None
Expand Down
Loading