Fix bad method links in docstrings (#13471)

# Description

Seems like I developed a bit of a bad habit of trying to link

```rust
/// [`.foo()`]
```

in docstrings, and this just doesn't work automatically; you have to do 

```rust
/// [`.foo()`](Self::foo)
```

if you want it to actually link. I think I found and replaced all of
these.

# User-Facing Changes

Just docs.
This commit is contained in:
Devyn Cairns
2024-07-27 19:39:29 -07:00
committed by GitHub
parent d80de68665
commit d618fd0527
15 changed files with 40 additions and 37 deletions

View File

@ -75,8 +75,8 @@ use crate::{EngineInterface, EvaluatedCall, Plugin};
pub trait PluginCommand: Sync {
/// The type of plugin this command runs on.
///
/// Since [`.run()`] takes a reference to the plugin, it is necessary to define the type of
/// plugin that the command expects here.
/// Since [`.run()`](Self::run) takes a reference to the plugin, it is necessary to define the
/// type of plugin that the command expects here.
type Plugin: Plugin;
/// The name of the command from within Nu.
@ -96,9 +96,9 @@ pub trait PluginCommand: Sync {
/// Additional documentation for usage of the command.
///
/// This is optional - any arguments documented by [`.signature()`] will be shown in the help
/// page automatically. However, this can be useful for explaining things that would be too
/// brief to include in [`.usage()`] and may span multiple lines.
/// This is optional - any arguments documented by [`.signature()`](Self::signature) will be
/// shown in the help page automatically. However, this can be useful for explaining things that
/// would be too brief to include in [`.usage()`](Self::usage) and may span multiple lines.
fn extra_usage(&self) -> &str {
""
}

View File

@ -618,8 +618,9 @@ impl EngineInterface {
/// Get all environment variables from the engine.
///
/// Since this is quite a large map that has to be sent, prefer to use [`.get_env_var()`] if
/// the variables needed are known ahead of time and there are only a small number needed.
/// Since this is quite a large map that has to be sent, prefer to use
/// [`.get_env_var()`] (Self::get_env_var) if the variables needed are known ahead of time
/// and there are only a small number needed.
///
/// # Example
/// ```rust,no_run
@ -873,9 +874,9 @@ impl EngineInterface {
}
/// Ask the engine for the identifier for a declaration. If found, the result can then be passed
/// to [`.call_decl()`] to call other internal commands.
/// to [`.call_decl()`](Self::call_decl) to call other internal commands.
///
/// See [`.call_decl()`] for an example.
/// See [`.call_decl()`](Self::call_decl) for an example.
pub fn find_decl(&self, name: impl Into<String>) -> Result<Option<DeclId>, ShellError> {
let call = EngineCall::FindDecl(name.into());
@ -890,7 +891,7 @@ impl EngineInterface {
}
/// Ask the engine to call an internal command, using the declaration ID previously looked up
/// with [`.find_decl()`].
/// with [`.find_decl()`](Self::find_decl).
///
/// # Example
///
@ -1008,7 +1009,7 @@ impl Interface for EngineInterface {
/// Keeps the plugin in the foreground as long as it is alive.
///
/// Use [`.leave()`] to leave the foreground without ignoring the error.
/// Use [`.leave()`](Self::leave) to leave the foreground without ignoring the error.
pub struct ForegroundGuard(Option<EngineInterface>);
impl ForegroundGuard {