From ff7ff7d50d3a926fa54b0178a8fa6c165cd82da4 Mon Sep 17 00:00:00 2001 From: QiangHeisenberg Date: Thu, 4 May 2023 16:20:31 +0800 Subject: [PATCH] Added the no_run attribute --- crates/cargo-test-support/src/install.rs | 3 +- crates/cargo-test-support/src/registry.rs | 62 +++++++++++------------ 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/crates/cargo-test-support/src/install.rs b/crates/cargo-test-support/src/install.rs index 3b20c5463..02842ef7b 100644 --- a/crates/cargo-test-support/src/install.rs +++ b/crates/cargo-test-support/src/install.rs @@ -4,11 +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"); +/// ``` #[track_caller] pub fn assert_has_installed_exe>(path: P, name: &'static str) { assert!(check_has_installed_exe(path, name)); diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs index a8a16c79b..5f4edd546 100644 --- a/crates/cargo-test-support/src/registry.rs +++ b/crates/cargo-test-support/src/registry.rs @@ -450,45 +450,43 @@ impl RegistryBuilder { /// `VendorPackage` which implements directory sources. /// /// # Example -/// ``` +/// ```no_run /// use cargo_test_support::registry::Package; /// use cargo_test_support::project; /// -/// fn crate_package_test() { -/// // Publish package "a" depending on "b". -/// Package::new("a", "1.0.0") -/// .dep("b", "1.0.0") -/// .file("src/lib.rs", r#" -/// extern crate b; -/// pub fn f() -> i32 { b::f() * 2 } -/// "#) -/// .publish(); +/// // Publish package "a" depending on "b". +/// Package::new("a", "1.0.0") +/// .dep("b", "1.0.0") +/// .file("src/lib.rs", r#" +/// extern crate b; +/// pub fn f() -> i32 { b::f() * 2 } +/// "#) +/// .publish(); /// -/// // Publish package "b". -/// Package::new("b", "1.0.0") -/// .file("src/lib.rs", r#" -/// pub fn f() -> i32 { 12 } -/// "#) -/// .publish(); +/// // Publish package "b". +/// Package::new("b", "1.0.0") +/// .file("src/lib.rs", r#" +/// pub fn f() -> i32 { 12 } +/// "#) +/// .publish(); /// -/// // Create a project that uses package "a". -/// let p = project() -/// .file("Cargo.toml", r#" -/// [package] -/// name = "foo" -/// version = "0.0.1" +/// // Create a project that uses package "a". +/// let p = project() +/// .file("Cargo.toml", r#" +/// [package] +/// name = "foo" +/// version = "0.0.1" /// -/// [dependencies] -/// a = "1.0" -/// "#) -/// .file("src/main.rs", r#" -/// extern crate a; -/// fn main() { println!("{}", a::f()); } -/// "#) -/// .build(); +/// [dependencies] +/// a = "1.0" +/// "#) +/// .file("src/main.rs", r#" +/// extern crate a; +/// fn main() { println!("{}", a::f()); } +/// "#) +/// .build(); /// -/// p.cargo("run").with_stdout("24").run(); -/// } +/// p.cargo("run").with_stdout("24").run(); /// ``` #[must_use] pub struct Package {