Skip to content

Commit

Permalink
Should not have to specify crates-io registry URL to replace-with
Browse files Browse the repository at this point in the history
Since cargo knows crates-io's registry URL and, anyway, you're trying to
say that you don't want to use crates-io.
  • Loading branch information
carols10cents committed Sep 18, 2016
1 parent 9399229 commit fcfbfae
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/cargo/sources/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ a lock file compatible with `{orig}` cannot be generated in this situation
path.push(s);
srcs.push(try!(SourceId::for_directory(&path)));
}
if name == "crates-io" && srcs.is_empty() {
srcs.push(try!(SourceId::crates_io(self.config)));
}

let mut srcs = srcs.into_iter();
let src = try!(srcs.next().chain_error(|| {
Expand Down
5 changes: 0 additions & 5 deletions tests/bad-config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ fn bad_source_config2() {
.file("src/lib.rs", "")
.file(".cargo/config", r#"
[source.crates-io]
registry = 'http://example.com'
replace-with = 'bar'
"#);

Expand Down Expand Up @@ -721,7 +720,6 @@ fn bad_source_config3() {
.file("src/lib.rs", "")
.file(".cargo/config", r#"
[source.crates-io]
registry = 'http://example.com'
replace-with = 'crates-io'
"#);

Expand Down Expand Up @@ -752,7 +750,6 @@ fn bad_source_config4() {
.file("src/lib.rs", "")
.file(".cargo/config", r#"
[source.crates-io]
registry = 'http://example.com'
replace-with = 'bar'
[source.bar]
Expand Down Expand Up @@ -788,7 +785,6 @@ fn bad_source_config5() {
.file("src/lib.rs", "")
.file(".cargo/config", r#"
[source.crates-io]
registry = 'http://example.com'
replace-with = 'bar'
[source.bar]
Expand Down Expand Up @@ -842,7 +838,6 @@ fn bad_source_config6() {
.file("src/lib.rs", "")
.file(".cargo/config", r#"
[source.crates-io]
registry = 'http://example.com'
replace-with = ['not', 'a', 'string']
"#);

Expand Down
1 change: 0 additions & 1 deletion tests/cargotest/support/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ pub fn init() {
token = "api-token"
[source.crates-io]
registry = 'https://wut'
replace-with = 'dummy-registry'
[source.dummy-registry]
Expand Down
1 change: 0 additions & 1 deletion tests/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ fn setup() {
t!(fs::create_dir(&root.join(".cargo")));
t!(t!(File::create(root.join(".cargo/config"))).write_all(br#"
[source.crates-io]
registry = 'https://wut'
replace-with = 'my-awesome-local-registry'
[source.my-awesome-local-registry]
Expand Down
2 changes: 0 additions & 2 deletions tests/local-registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ fn setup() {
t!(fs::create_dir(&root.join(".cargo")));
t!(t!(File::create(root.join(".cargo/config"))).write_all(br#"
[source.crates-io]
registry = 'https://wut'
replace-with = 'my-awesome-local-registry'
[source.my-awesome-local-registry]
Expand Down Expand Up @@ -274,7 +273,6 @@ fn invalid_dir_bad() {
.file("src/lib.rs", "")
.file(".cargo/config", r#"
[source.crates-io]
registry = 'https://wut'
replace-with = 'my-awesome-local-directory'
[source.my-awesome-local-directory]
Expand Down

0 comments on commit fcfbfae

Please sign in to comment.