Skip to content

Commit 56b8ae7

Browse files
committed
delete --host command and message
1 parent 259ea8c commit 56b8ae7

File tree

7 files changed

+4
-256
lines changed

7 files changed

+4
-256
lines changed

src/bin/cargo/commands/login.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ pub fn cli() -> App {
1010
)
1111
.arg(opt("quiet", "No output printed to stdout").short("q"))
1212
.arg(Arg::with_name("token"))
13-
// --host is deprecated (use --registry instead)
14-
.arg(
15-
opt("host", "Host to set the token for")
16-
.value_name("HOST")
17-
.hidden(true),
18-
)
1913
.arg(opt("registry", "Registry to use").value_name("REGISTRY"))
2014
.after_help("Run `cargo help login` for more detailed information.\n")
2115
}

src/bin/cargo/commands/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
3232

3333
let registry = args.registry(config)?;
3434
let ws = args.workspace(config)?;
35-
let index = args.index(config)?;
35+
let index = args.index()?;
3636

3737
ops::publish(
3838
&ws,

src/bin/cargo/commands/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn cli() -> App {
2323

2424
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
2525
let registry = args.registry(config)?;
26-
let index = args.index(config)?;
26+
let index = args.index()?;
2727
let limit = args.value_of_u32("limit")?;
2828
let limit = min(100, limit.unwrap_or(10));
2929
let query: Vec<&str> = args.values_of("query").unwrap_or_default().collect();

src/cargo/util/command_prelude.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -613,27 +613,8 @@ pub trait ArgMatchesExt {
613613
}
614614
}
615615

616-
fn index(&self, config: &Config) -> CargoResult<Option<String>> {
617-
// TODO: deprecated. Remove once it has been decided `--host` can be removed
618-
// We may instead want to repurpose the host flag, as mentioned in issue
619-
// rust-lang/cargo#4208.
620-
let msg = "The flag '--host' is no longer valid.
621-
622-
Previous versions of Cargo accepted this flag, but it is being
623-
deprecated. The flag is being renamed to 'index', as the flag
624-
wants the location of the index. Please use '--index' instead.
625-
626-
This will soon become a hard error, so it's either recommended
627-
to update to a fixed version or contact the upstream maintainer
628-
about this warning.";
629-
630-
let index = match self._value_of("host") {
631-
Some(host) => {
632-
config.shell().warn(&msg)?;
633-
Some(host.to_string())
634-
}
635-
None => self._value_of("index").map(|s| s.to_string()),
636-
};
616+
fn index(&self) -> CargoResult<Option<String>> {
617+
let index = self._value_of("index").map(|s| s.to_string());
637618
Ok(index)
638619
}
639620

tests/testsuite/login.rs

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -66,83 +66,6 @@ fn check_token(expected_token: &str, registry: Option<&str>) -> bool {
6666
}
6767
}
6868

69-
#[cargo_test]
70-
fn login_with_old_credentials() {
71-
registry::init();
72-
73-
cargo_process("login --host")
74-
.arg(registry_url().to_string())
75-
.arg(TOKEN)
76-
.run();
77-
78-
// Ensure that we get the new token for the registry
79-
assert!(check_token(TOKEN, None));
80-
}
81-
82-
#[cargo_test]
83-
fn login_with_new_credentials() {
84-
registry::init();
85-
setup_new_credentials();
86-
87-
cargo_process("login --host")
88-
.arg(registry_url().to_string())
89-
.arg(TOKEN)
90-
.run();
91-
92-
// Ensure that we get the new token for the registry
93-
assert!(check_token(TOKEN, None));
94-
}
95-
96-
#[cargo_test]
97-
fn credentials_work_with_extension() {
98-
registry::init();
99-
setup_new_credentials_toml();
100-
101-
cargo_process("login --host")
102-
.arg(registry_url().to_string())
103-
.arg(TOKEN)
104-
.run();
105-
106-
// Ensure that we get the new token for the registry
107-
assert!(check_token(TOKEN, None));
108-
}
109-
110-
#[cargo_test]
111-
fn login_with_old_and_new_credentials() {
112-
setup_new_credentials();
113-
login_with_old_credentials();
114-
}
115-
116-
#[cargo_test]
117-
fn login_without_credentials() {
118-
registry::init();
119-
cargo_process("login --host")
120-
.arg(registry_url().to_string())
121-
.arg(TOKEN)
122-
.run();
123-
124-
// Ensure that we get the new token for the registry
125-
assert!(check_token(TOKEN, None));
126-
}
127-
128-
#[cargo_test]
129-
fn new_credentials_is_used_instead_old() {
130-
registry::init();
131-
setup_new_credentials();
132-
133-
cargo_process("login --host")
134-
.arg(registry_url().to_string())
135-
.arg(TOKEN)
136-
.run();
137-
138-
let mut config = Config::new(Shell::new(), cargo_home(), cargo_home());
139-
let _ = config.values();
140-
let _ = config.load_credentials();
141-
142-
let token = config.get_string("registry.token").unwrap().map(|p| p.val);
143-
assert_eq!(token.unwrap(), TOKEN);
144-
}
145-
14669
#[cargo_test]
14770
fn registry_credentials() {
14871
registry::alt_init();

tests/testsuite/publish.rs

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -185,102 +185,6 @@ See [..]
185185
validate_upload_foo();
186186
}
187187

188-
// TODO: Deprecated
189-
// remove once it has been decided --host can be removed
190-
#[cargo_test]
191-
fn simple_with_host() {
192-
registry::init();
193-
194-
let p = project()
195-
.file(
196-
"Cargo.toml",
197-
r#"
198-
[project]
199-
name = "foo"
200-
version = "0.0.1"
201-
authors = []
202-
license = "MIT"
203-
description = "foo"
204-
"#,
205-
)
206-
.file("src/main.rs", "fn main() {}")
207-
.build();
208-
209-
p.cargo("publish --no-verify --token sekrit --host")
210-
.arg(registry_url().to_string())
211-
.with_stderr(&format!(
212-
"\
213-
[WARNING] The flag '--host' is no longer valid.
214-
215-
Previous versions of Cargo accepted this flag, but it is being
216-
deprecated. The flag is being renamed to 'index', as the flag
217-
wants the location of the index. Please use '--index' instead.
218-
219-
This will soon become a hard error, so it's either recommended
220-
to update to a fixed version or contact the upstream maintainer
221-
about this warning.
222-
[UPDATING] `{reg}` index
223-
[WARNING] manifest has no documentation, [..]
224-
See [..]
225-
[PACKAGING] foo v0.0.1 ([CWD])
226-
[UPLOADING] foo v0.0.1 ([CWD])
227-
",
228-
reg = registry_path().to_str().unwrap()
229-
))
230-
.run();
231-
232-
validate_upload_foo();
233-
}
234-
235-
// TODO: Deprecated
236-
// remove once it has been decided --host can be removed
237-
#[cargo_test]
238-
fn simple_with_index_and_host() {
239-
registry::init();
240-
241-
let p = project()
242-
.file(
243-
"Cargo.toml",
244-
r#"
245-
[project]
246-
name = "foo"
247-
version = "0.0.1"
248-
authors = []
249-
license = "MIT"
250-
description = "foo"
251-
"#,
252-
)
253-
.file("src/main.rs", "fn main() {}")
254-
.build();
255-
256-
p.cargo("publish --no-verify --token sekrit --index")
257-
.arg(registry_url().to_string())
258-
.arg("--host")
259-
.arg(registry_url().to_string())
260-
.with_stderr(&format!(
261-
"\
262-
[WARNING] The flag '--host' is no longer valid.
263-
264-
Previous versions of Cargo accepted this flag, but it is being
265-
deprecated. The flag is being renamed to 'index', as the flag
266-
wants the location of the index. Please use '--index' instead.
267-
268-
This will soon become a hard error, so it's either recommended
269-
to update to a fixed version or contact the upstream maintainer
270-
about this warning.
271-
[UPDATING] `{reg}` index
272-
[WARNING] manifest has no documentation, [..]
273-
See [..]
274-
[PACKAGING] foo v0.0.1 ([CWD])
275-
[UPLOADING] foo v0.0.1 ([CWD])
276-
",
277-
reg = registry_path().to_str().unwrap()
278-
))
279-
.run();
280-
281-
validate_upload_foo();
282-
}
283-
284188
#[cargo_test]
285189
fn git_deps() {
286190
registry::init();

tests/testsuite/search.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -181,60 +181,6 @@ fn simple() {
181181
.run();
182182
}
183183

184-
// TODO: Deprecated
185-
// remove once it has been decided '--host' can be safely removed
186-
#[cargo_test]
187-
fn simple_with_host() {
188-
setup();
189-
190-
cargo_process("search postgres --host")
191-
.arg(registry_url().to_string())
192-
.with_stderr(
193-
"\
194-
[WARNING] The flag '--host' is no longer valid.
195-
196-
Previous versions of Cargo accepted this flag, but it is being
197-
deprecated. The flag is being renamed to 'index', as the flag
198-
wants the location of the index. Please use '--index' instead.
199-
200-
This will soon become a hard error, so it's either recommended
201-
to update to a fixed version or contact the upstream maintainer
202-
about this warning.
203-
[UPDATING] `[CWD]/registry` index
204-
",
205-
)
206-
.with_stdout_contains(SEARCH_RESULTS)
207-
.run();
208-
}
209-
210-
// TODO: Deprecated
211-
// remove once it has been decided '--host' can be safely removed
212-
#[cargo_test]
213-
fn simple_with_index_and_host() {
214-
setup();
215-
216-
cargo_process("search postgres --index")
217-
.arg(registry_url().to_string())
218-
.arg("--host")
219-
.arg(registry_url().to_string())
220-
.with_stderr(
221-
"\
222-
[WARNING] The flag '--host' is no longer valid.
223-
224-
Previous versions of Cargo accepted this flag, but it is being
225-
deprecated. The flag is being renamed to 'index', as the flag
226-
wants the location of the index. Please use '--index' instead.
227-
228-
This will soon become a hard error, so it's either recommended
229-
to update to a fixed version or contact the upstream maintainer
230-
about this warning.
231-
[UPDATING] `[CWD]/registry` index
232-
",
233-
)
234-
.with_stdout_contains(SEARCH_RESULTS)
235-
.run();
236-
}
237-
238184
#[cargo_test]
239185
fn multiple_query_params() {
240186
setup();

0 commit comments

Comments
 (0)