Skip to content
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
12 changes: 5 additions & 7 deletions src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,19 +423,17 @@ pub fn search(query: &str,
}
None => name
};
writeln!(config.shell().err(), "{}", line)?;
println!("{}", line);
}

let search_max_limit = 100;
if total_crates > limit as u32 && limit < search_max_limit {
writeln!(config.shell().err(),
"... and {} crates more (use --limit N to see more)",
total_crates - limit as u32)?;
println!("... and {} crates more (use --limit N to see more)",
total_crates - limit as u32);
} else if total_crates > limit as u32 && limit >= search_max_limit {
writeln!(config.shell().err(),
"... and {} crates more (go to http://crates.io/search?q={} to see more)",
println!("... and {} crates more (go to http://crates.io/search?q={} to see more)",
total_crates - limit as u32,
percent_encode(query.as_bytes(), QUERY_ENCODE_SET))?;
percent_encode(query.as_bytes(), QUERY_ENCODE_SET));
}

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions tests/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn simple() {
assert_that(cargo_process("search").arg("postgres")
.arg("--host").arg(registry().to_string()),
execs().with_status(0)
.with_stderr_contains("\
.with_stdout_contains("\
hoare = \"0.1.1\" # Design by contract style assertions for Rust"));
}

Expand Down Expand Up @@ -134,7 +134,7 @@ fn multiple_query_params() {
assert_that(cargo_process("search").arg("postgres").arg("sql")
.arg("--host").arg(registry().to_string()),
execs().with_status(0)
.with_stderr_contains("\
.with_stdout_contains("\
hoare = \"0.1.1\" # Design by contract style assertions for Rust"));
}

Expand Down