Skip to content

Commit

Permalink
Auto merge of #7374 - alexcrichton:less-url-serde, r=ehuss
Browse files Browse the repository at this point in the history
Don't require the `serde` feature of `url`

Ends up meaning that in full crate compiles that `url` doesn't wait for
`serde` to finish, which in turn enables crates like `git2` to start
sooner!
  • Loading branch information
bors committed Sep 17, 2019
2 parents d764fff + 2f79b20 commit cdf7f63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tar = { version = "0.4.18", default-features = false }
tempfile = "3.0"
termcolor = "1.0"
toml = "0.5.3"
url = { version = "2.0", features = ['serde'] }
url = "2.0"
walkdir = "2.2"
clap = "2.31.2"
unicode-width = "0.1.5"
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/core/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use semver::ReqParseError;
use semver::VersionReq;
use serde::ser;
use serde::Serialize;
use url::Url;

use crate::core::interning::InternedString;
use crate::core::{PackageId, SourceId, Summary};
Expand Down Expand Up @@ -69,14 +68,15 @@ struct SerializedDependency<'a> {
target: Option<&'a Platform>,
/// The registry URL this dependency is from.
/// If None, then it comes from the default registry (crates.io).
registry: Option<Url>,
registry: Option<&'a str>,
}

impl ser::Serialize for Dependency {
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where
S: ser::Serializer,
{
let registry_id = self.registry_id();
SerializedDependency {
name: &*self.package_name(),
source: self.source_id(),
Expand All @@ -87,7 +87,7 @@ impl ser::Serialize for Dependency {
features: self.features(),
target: self.platform(),
rename: self.explicit_name_in_toml().map(|s| s.as_str()),
registry: self.registry_id().map(|sid| sid.url().clone()),
registry: registry_id.as_ref().map(|sid| sid.url().as_str()),
}
.serialize(s)
}
Expand Down

0 comments on commit cdf7f63

Please sign in to comment.