mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-20 17:46:37 +00:00
Refactor: check --version and $crate@$version conflict in cargo-binstall (#2201)
* Rm Options::version_req Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Refactor filter_out_installed_crates Detect conflict between --version and crate@version in it, instead of in resolve Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix resolve.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix fmt in entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Rm unused import in ops.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix fmt in entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --------- Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
5de9e7fc28
commit
390406d635
3 changed files with 30 additions and 24 deletions
|
@ -3,7 +3,6 @@
|
|||
use std::{path::PathBuf, sync::Arc, time::Duration};
|
||||
|
||||
use compact_str::CompactString;
|
||||
use semver::VersionReq;
|
||||
|
||||
use crate::{
|
||||
fetchers::{Data, Fetcher, SignaturePolicy, TargetDataErased},
|
||||
|
@ -38,7 +37,6 @@ pub struct Options {
|
|||
pub locked: bool,
|
||||
pub no_track: bool,
|
||||
|
||||
pub version_req: Option<VersionReq>,
|
||||
pub cargo_toml_fetch_override: Option<CargoTomlFetchOverride>,
|
||||
pub cli_overrides: PkgOverride,
|
||||
|
||||
|
|
|
@ -67,12 +67,7 @@ async fn resolve_inner(
|
|||
) -> Result<Resolution, BinstallError> {
|
||||
info!("Resolving package: '{}'", crate_name);
|
||||
|
||||
let version_req = match (&crate_name.version_req, &opts.version_req) {
|
||||
(Some(version), None) => MaybeOwned::Borrowed(version),
|
||||
(None, Some(version)) => MaybeOwned::Borrowed(version),
|
||||
(Some(_), Some(_)) => Err(BinstallError::SuperfluousVersionOption)?,
|
||||
(None, None) => MaybeOwned::Owned(VersionReq::STAR),
|
||||
};
|
||||
let version_req = crate_name.version_req.unwrap_or(VersionReq::STAR);
|
||||
|
||||
let version_req_str = version_req.to_compact_string();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue