Skip to content

Commit e306556

Browse files
committed
docs: Focus the summary for API items
This was aided by `clippy::too_long_first_doc_paragraph`
1 parent 878caf7 commit e306556

File tree

7 files changed

+32
-15
lines changed

7 files changed

+32
-15
lines changed

crates/cargo-test-support/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1565,9 +1565,10 @@ pub fn is_coarse_mtime() -> bool {
15651565
cfg!(target_os = "macos") && is_ci()
15661566
}
15671567

1568+
/// A way for to increase the cut off for all the time based test.
1569+
///
15681570
/// Some CI setups are much slower then the equipment used by Cargo itself.
15691571
/// Architectures that do not have a modern processor, hardware emulation, etc.
1570-
/// This provides a way for those setups to increase the cut off for all the time based test.
15711572
pub fn slow_cpu_multiplier(main: u64) -> Duration {
15721573
static SLOW_CPU_MULTIPLIER: OnceLock<u64> = OnceLock::new();
15731574
let slow_cpu_multiplier = SLOW_CPU_MULTIPLIER.get_or_init(|| {

crates/home/src/env.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ pub fn home_dir_with_env(env: &dyn Env) -> Option<PathBuf> {
4747
env.home_dir()
4848
}
4949

50-
/// Variant of `cargo_home` where the environment source is parameterized. This is
50+
/// Variant of `cargo_home` where the environment source is parameterized.
51+
///
52+
/// This is
5153
/// specifically to support in-process testing scenarios as environment
5254
/// variables and user home metadata are normally process global state. See the
5355
/// [`Env`] trait.
@@ -57,7 +59,9 @@ pub fn cargo_home_with_env(env: &dyn Env) -> io::Result<PathBuf> {
5759
}
5860

5961
/// Variant of `cargo_home_with_cwd` where the environment source is
60-
/// parameterized. This is specifically to support in-process testing scenarios
62+
/// parameterized.
63+
///
64+
/// This is specifically to support in-process testing scenarios
6165
/// as environment variables and user home metadata are normally process global
6266
/// state. See the `OsEnv` trait.
6367
pub fn cargo_home_with_cwd_env(env: &dyn Env, cwd: &Path) -> io::Result<PathBuf> {
@@ -77,7 +81,9 @@ pub fn cargo_home_with_cwd_env(env: &dyn Env, cwd: &Path) -> io::Result<PathBuf>
7781
}
7882

7983
/// Variant of `cargo_home_with_cwd` where the environment source is
80-
/// parameterized. This is specifically to support in-process testing scenarios
84+
/// parameterized.
85+
///
86+
/// This is specifically to support in-process testing scenarios
8187
/// as environment variables and user home metadata are normally process global
8288
/// state. See the `OsEnv` trait.
8389
pub fn rustup_home_with_env(env: &dyn Env) -> io::Result<PathBuf> {
@@ -86,7 +92,9 @@ pub fn rustup_home_with_env(env: &dyn Env) -> io::Result<PathBuf> {
8692
}
8793

8894
/// Variant of `cargo_home_with_cwd` where the environment source is
89-
/// parameterized. This is specifically to support in-process testing scenarios
95+
/// parameterized.
96+
///
97+
/// This is specifically to support in-process testing scenarios
9098
/// as environment variables and user home metadata are normally process global
9199
/// state. See the `OsEnv` trait.
92100
pub fn rustup_home_with_cwd_env(env: &dyn Env, cwd: &Path) -> io::Result<PathBuf> {

crates/resolver-tests/src/sat.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ fn log_bits(x: usize) -> usize {
2020
(num_bits::<usize>() as u32 - x.leading_zeros()) as usize
2121
}
2222

23-
// At this point is possible to select every version of every package.
24-
// So we need to mark certain versions as incompatible with each other.
25-
// We could add a clause not A, not B for all A and B that are incompatible,
23+
/// At this point is possible to select every version of every package.
24+
///
25+
/// So we need to mark certain versions as incompatible with each other.
26+
/// We could add a clause not A, not B for all A and B that are incompatible,
2627
fn sat_at_most_one(solver: &mut varisat::Solver<'_>, vars: &[varisat::Var]) {
2728
if vars.len() <= 1 {
2829
return;
@@ -327,7 +328,9 @@ fn process_compatible_dep_summaries(
327328
}
328329
}
329330

330-
/// Resolution can be reduced to the SAT problem. So this is an alternative implementation
331+
/// Resolution can be reduced to the SAT problem.
332+
///
333+
/// So this is an alternative implementation
331334
/// of the resolver that uses a SAT library for the hard work. This is intended to be easy to read,
332335
/// as compared to the real resolver.
333336
///

credential/cargo-credential/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ pub enum CacheControl {
211211
Unknown,
212212
}
213213

214-
/// Credential process JSON protocol version. If the protocol needs to make
214+
/// Credential process JSON protocol version.
215+
///
216+
/// If the protocol needs to make
215217
/// a breaking change, a new protocol version should be defined (`PROTOCOL_VERSION_2`).
216218
/// This library should offer support for both protocols if possible, by signaling
217219
/// in the `CredentialHello` message. Cargo will then choose which protocol to use,

src/cargo/core/compiler/build_config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ pub enum MessageFormat {
154154
}
155155

156156
/// The general "mode" for what to do.
157+
///
157158
/// This is used for two purposes. The commands themselves pass this in to
158159
/// `compile_ws` to tell it the general execution strategy. This influences
159160
/// the default targets selected. The other use is in the `Unit` struct

src/cargo/util/context/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ use environment::Env;
113113

114114
use super::auth::RegistryConfig;
115115

116-
// Helper macro for creating typed access methods.
116+
/// Helper macro for creating typed access methods.
117117
macro_rules! get_value_typed {
118118
($name:ident, $ty:ty, $variant:ident, $expected:expr) => {
119119
/// Low-level private method for getting a config value as an [`OptValue`].
@@ -2916,11 +2916,11 @@ impl StringList {
29162916
}
29172917
}
29182918

2919-
/// `StringList` automatically merges config values with environment values,
2920-
/// this instead follows the precedence rules, so that eg. a string list found
2921-
/// in the environment will be used instead of one in a config file.
2919+
/// Alternative to [`StringList`] that follows precedence rules, rather than merging config values with environment values,
29222920
///
2923-
/// This is currently only used by `PathAndArgs`
2921+
/// e.g. a string list found in the environment will be used instead of one in a config file.
2922+
///
2923+
/// This is currently only used by [`PathAndArgs`]
29242924
#[derive(Debug, Deserialize)]
29252925
pub struct UnmergedStringList(Vec<String>);
29262926

src/cargo/util/workspace.rs

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ pub fn print_available_tests(ws: &Workspace<'_>, options: &CompileOptions) -> Ca
9595
print_available_targets(Target::is_test, ws, options, "--test", "test targets")
9696
}
9797

98+
/// The source path and its current dir for use in compilation.
99+
///
98100
/// The path that we pass to rustc is actually fairly important because it will
99101
/// show up in error messages (important for readability), debug information
100102
/// (important for caching), etc. As a result we need to be pretty careful how we

0 commit comments

Comments
 (0)