Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Dependency's source member the same type as Package's source member: Option<Source> #277

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Updated dependencies:
- `thiserror` from `1.0.31` to `2.0.3`
- `derive_builder` from `0.12` to `0.20`
- Made `Dependency`'s `source` member the same type as `Package`'s `source` member: `Option<Source>`.

### Removed

Expand Down
4 changes: 3 additions & 1 deletion src/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct Dependency {
/// Name as given in the `Cargo.toml`
pub name: String,
/// The source of dependency
pub source: Option<String>,
pub source: Option<Source>,
/// The required version
pub req: VersionReq,
/// The kind of dependency this is
Expand Down Expand Up @@ -83,3 +83,5 @@ pub struct Dependency {
}

pub use cargo_platform::Platform;

use crate::Source;
oli-obk marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions tests/test_samples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern crate serde_json;
use camino::Utf8PathBuf;
use cargo_metadata::{
workspace_default_members_is_missing, ArtifactDebuginfo, CargoOpt, DependencyKind, Edition,
Message, Metadata, MetadataCommand,
Message, Metadata, MetadataCommand, Source,
};

/// Output from oldest version ever supported (1.24).
Expand Down Expand Up @@ -240,7 +240,9 @@ fn all_the_fields() {
.unwrap();
assert_eq!(
bitflags.source,
Some("registry+https://github.com/rust-lang/crates.io-index".to_string())
Some(Source {
repr: "registry+https://github.com/rust-lang/crates.io-index".to_string()
})
);
assert!(bitflags.optional);
assert_eq!(bitflags.req, semver::VersionReq::parse("^1.0").unwrap());
Expand Down
Loading