Skip to content

Commit 24cf9c5

Browse files
committed
Auto merge of #9093 - ehuss:remove-registry-new, r=alexcrichton
Remove Registry::new. `Registry::new` doesn't work in most circumstances because crates.io requires a user-agent, and it does not set one. This also bumps the version over 0.32 due to #8914. Closes #8914. Closes #9040.
2 parents 638f33d + eaa5896 commit 24cf9c5

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = "src/cargo/lib.rs"
2222
atty = "0.2"
2323
bytesize = "1.0"
2424
cargo-platform = { path = "crates/cargo-platform", version = "0.1.1" }
25-
crates-io = { path = "crates/crates-io", version = "0.31.1" }
25+
crates-io = { path = "crates/crates-io", version = "0.33.0" }
2626
crossbeam-utils = "0.8"
2727
crypto-hash = "0.3.1"
2828
curl = { version = "0.4.23", features = ["http2"] }

crates/crates-io/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "crates-io"
3-
version = "0.31.1"
3+
version = "0.33.0"
44
edition = "2018"
55
authors = ["Alex Crichton <[email protected]>"]
66
license = "MIT OR Apache-2.0"

crates/crates-io/lib.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,19 @@ struct Crates {
122122
meta: TotalCrates,
123123
}
124124
impl Registry {
125-
pub fn new(host: String, token: Option<String>) -> Registry {
126-
Registry::new_handle(host, token, Easy::new())
127-
}
128-
125+
/// Creates a new `Registry`.
126+
///
127+
/// ## Example
128+
///
129+
/// ```rust
130+
/// use curl::easy::Easy;
131+
/// use crates_io::Registry;
132+
///
133+
/// let mut handle = Easy::new();
134+
/// // If connecting to crates.io, a user-agent is required.
135+
/// handle.useragent("my_crawler (example.com/info)");
136+
/// let mut reg = Registry::new_handle(String::from("https://crates.io"), None, handle);
137+
/// ```
129138
pub fn new_handle(host: String, token: Option<String>, handle: Easy) -> Registry {
130139
Registry {
131140
host,

0 commit comments

Comments
 (0)