Skip to content

Commit

Permalink
Auto merge of #12055 - QiangHeisenberg:crates-io-doc-test, r=weihanglo
Browse files Browse the repository at this point in the history
fix:  doc-test failures

### What does this PR try to resolve?

When I read the source code, I found that the `Registry::new_handle` document test failed and seemed to be missing parameters;

There is no change in this [PR](https://github.com/rust-lang/cargo/pull/10592/files#diff-12973056cf99e8de997011a8738a6740a7dfd06142a73f122f3b35218db37351).
  • Loading branch information
bors committed May 4, 2023
2 parents 6240788 + ff7ff7d commit 0ced62b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
6 changes: 5 additions & 1 deletion crates/cargo-test-support/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ use std::path::{Path, PathBuf};

/// Used by `cargo install` tests to assert an executable binary
/// has been installed. Example usage:
/// ```no_run
/// use cargo_test_support::install::assert_has_installed_exe;
/// use cargo_test_support::install::cargo_home;
///
/// assert_has_installed_exe(cargo_home(), "foo");
/// assert_has_installed_exe(cargo_home(), "foo");
/// ```
#[track_caller]
pub fn assert_has_installed_exe<P: AsRef<Path>>(path: P, name: &'static str) {
assert!(check_has_installed_exe(path, name));
Expand Down
6 changes: 4 additions & 2 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,15 @@ impl Execs {
/// The substrings are matched as `contains`. Example:
///
/// ```no_run
/// execs.with_stderr_line_without(
/// use cargo_test_support::execs;
///
/// execs().with_stderr_line_without(
/// &[
/// "[RUNNING] `rustc --crate-name build_script_build",
/// "-C opt-level=3",
/// ],
/// &["-C debuginfo", "-C incremental"],
/// )
/// );
/// ```
///
/// This will check that a build line includes `-C opt-level=3` but does
Expand Down
13 changes: 8 additions & 5 deletions crates/cargo-test-support/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,10 @@ impl RegistryBuilder {
/// `VendorPackage` which implements directory sources.
///
/// # Example
/// ```
/// ```no_run
/// use cargo_test_support::registry::Package;
/// use cargo_test_support::project;
///
/// // Publish package "a" depending on "b".
/// Package::new("a", "1.0.0")
/// .dep("b", "1.0.0")
Expand Down Expand Up @@ -1241,7 +1244,7 @@ impl Package {
}

/// Adds a normal dependency. Example:
/// ```
/// ```toml
/// [dependencies]
/// foo = {version = "1.0"}
/// ```
Expand All @@ -1250,7 +1253,7 @@ impl Package {
}

/// Adds a dependency with the given feature. Example:
/// ```
/// ```toml
/// [dependencies]
/// foo = {version = "1.0", "features": ["feat1", "feat2"]}
/// ```
Expand All @@ -1273,7 +1276,7 @@ impl Package {
}

/// Adds a dev-dependency. Example:
/// ```
/// ```toml
/// [dev-dependencies]
/// foo = {version = "1.0"}
/// ```
Expand All @@ -1282,7 +1285,7 @@ impl Package {
}

/// Adds a build-dependency. Example:
/// ```
/// ```toml
/// [build-dependencies]
/// foo = {version = "1.0"}
/// ```
Expand Down
2 changes: 1 addition & 1 deletion crates/crates-io/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl Registry {
/// let mut handle = Easy::new();
/// // If connecting to crates.io, a user-agent is required.
/// handle.useragent("my_crawler (example.com/info)");
/// let mut reg = Registry::new_handle(String::from("https://crates.io"), None, handle);
/// let mut reg = Registry::new_handle(String::from("https://crates.io"), None, handle, true);
/// ```
pub fn new_handle(
host: String,
Expand Down

0 comments on commit 0ced62b

Please sign in to comment.