Skip to content

Update the url crate to 2.0 #7175

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

Merged
merged 1 commit into from
Jul 25, 2019
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
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.0"
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