Skip to content

Commit

Permalink
Auto merge of #7175 - alexcrichton:update-url, r=ehuss
Browse files Browse the repository at this point in the history
Update the `url` crate to 2.0

Looks like minor API changes, primarily around percent encoding.
  • Loading branch information
bors committed Jul 25, 2019
2 parents c2ef5fd + 3c67dc8 commit 5251d92
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ libgit2-sys = "0.8.2"
memchr = "2.1.3"
num_cpus = "1.0"
opener = "0.4"
percent-encoding = "2.0"
rustfix = "0.4.4"
same-file = "1"
semver = { version = "0.9.0", features = ["serde"] }
Expand All @@ -58,8 +59,7 @@ tar = { version = "0.4.18", default-features = false }
tempfile = "3.0"
termcolor = "1.0"
toml = "0.5.0"
url = "1.1"
url_serde = "0.2.0"
url = { version = "2.0", features = ['serde'] }
walkdir = "2.2"
clap = "2.31.2"
unicode-width = "0.1.5"
Expand Down
3 changes: 2 additions & 1 deletion crates/crates-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ path = "lib.rs"
curl = "0.4"
failure = "0.1.1"
http = "0.1"
percent-encoding = "2.0"
serde = { version = "1.0", features = ['derive'] }
serde_derive = "1.0"
serde_json = "1.0"
url = "1.0"
url = "2.0"
4 changes: 2 additions & 2 deletions crates/crates-io/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::time::Instant;
use curl::easy::{Easy, List};
use failure::bail;
use http::status::StatusCode;
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
use serde::{Deserialize, Serialize};
use serde_json;
use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET};
use url::Url;

pub type Result<T> = std::result::Result<T, failure::Error>;
Expand Down Expand Up @@ -256,7 +256,7 @@ impl Registry {
}

pub fn search(&mut self, query: &str, limit: u32) -> Result<(Vec<Crate>, u32)> {
let formatted_query = percent_encode(query.as_bytes(), QUERY_ENCODE_SET);
let formatted_query = percent_encode(query.as_bytes(), NON_ALPHANUMERIC);
let body = self.req(
&format!("/crates?q={}&per_page={}", formatted_query, limit),
None,
Expand Down
1 change: 0 additions & 1 deletion src/cargo/core/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ 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).
#[serde(with = "url_serde")]
registry: Option<Url>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crates_io::{NewCrate, NewCrateDependency, Registry};
use curl::easy::{Easy, InfoType, SslOpt};
use failure::{bail, format_err};
use log::{log, Level};
use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET};
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};

use crate::core::dependency::Kind;
use crate::core::manifest::ManifestMetadata;
Expand Down Expand Up @@ -766,7 +766,7 @@ pub fn search(
let extra = if source_id.is_default_registry() {
format!(
" (go to https://crates.io/search?q={} to see more)",
percent_encode(query.as_bytes(), QUERY_ENCODE_SET)
percent_encode(query.as_bytes(), NON_ALPHANUMERIC)
)
} else {
String::new()
Expand Down

0 comments on commit 5251d92

Please sign in to comment.