mirror of
https://github.com/rust-lang/cargo
synced 2024-08-28 11:50:23 +00:00
Update the url
crate to 2.0
Looks like minor API changes, primarily around percent encoding.
This commit is contained in:
parent
767ecea0b4
commit
3c67dc8430
|
@ -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"] }
|
||||
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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>;
|
||||
|
@ -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,
|
||||
|
|
|
@ -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>,
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue