diff --git a/src/completion.rs b/src/completion.rs index 9566f7845..be51181b3 100644 --- a/src/completion.rs +++ b/src/completion.rs @@ -405,7 +405,7 @@ pub fn extract_word( } } -/// Returns the longest common prefix among all `Candidate::replacement()`s. +/// Returns the longest common prefix among all [`Candidate::replacement()`]s. pub fn longest_common_prefix(candidates: &[C]) -> Option<&str> { if candidates.is_empty() { return None; diff --git a/src/config.rs b/src/config.rs index b0092dcce..2105d90b2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -88,14 +88,14 @@ impl Config { /// Completion behaviour. /// - /// By default, `CompletionType::Circular`. + /// By default, [`CompletionType::Circular`]. #[must_use] pub fn completion_type(&self) -> CompletionType { self.completion_type } /// When listing completion alternatives, only display - /// one screen of possibilities at a time (used for `CompletionType::List` + /// one screen of possibilities at a time (used for [`CompletionType::List`] /// mode). #[must_use] pub fn completion_prompt_limit(&self) -> usize { @@ -103,10 +103,10 @@ impl Config { } /// Duration (milliseconds) Rustyline will wait for a character when - /// reading an ambiguous key sequence (used for `EditMode::Vi` mode on unix - /// platform). + /// reading an ambiguous key sequence (used for [`EditMode::Vi`] mode on + /// unix platform). /// - /// By default, no timeout (-1) or 500ms if `EditMode::Vi` is activated. + /// By default, no timeout (-1) or 500ms if [`EditMode::Vi`] is activated. #[must_use] pub fn keyseq_timeout(&self) -> Option { self.keyseq_timeout @@ -329,7 +329,7 @@ pub struct Builder { } impl Builder { - /// Returns a `Config` builder. + /// Returns a [`Config`] builder. #[must_use] pub fn new() -> Self { Self { @@ -474,7 +474,7 @@ impl Builder { self } - /// Builds a `Config` with the settings specified so far. + /// Builds a [`Config`] with the settings specified so far. #[must_use] pub fn build(self) -> Config { self.p @@ -487,7 +487,7 @@ impl Configurer for Builder { } } -/// Trait for component that holds a `Config`. +/// Trait for component that holds a [`Config`]. pub trait Configurer { /// `Config` accessor. fn config_mut(&mut self) -> &mut Config; diff --git a/src/highlight.rs b/src/highlight.rs index 6cc718a07..b878ce171 100644 --- a/src/highlight.rs +++ b/src/highlight.rs @@ -4,7 +4,8 @@ use crate::config::CompletionType; use std::borrow::Cow::{self, Borrowed, Owned}; use std::cell::Cell; -/// Describe which kind of action has been triggering the call to `Highlighter`. +/// Describe which kind of action has been triggering the call to +/// [`Highlighter`]. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum CmdKind { /// Cursor moved @@ -48,7 +49,7 @@ pub trait Highlighter { /// Takes the completion `candidate` and /// returns the highlighted version (with ANSI color). /// - /// Currently, used only with `CompletionType::List`. + /// Currently, used only with [`CompletionType::List`]. fn highlight_candidate<'c>( &self, candidate: &'c str, // FIXME should be Completer::Candidate diff --git a/src/history.rs b/src/history.rs index 51abe637f..d6f311e6d 100644 --- a/src/history.rs +++ b/src/history.rs @@ -194,9 +194,9 @@ impl MemHistory { } /// Customized constructor with: - /// - `Config::max_history_size()`, - /// - `Config::history_ignore_space()`, - /// - `Config::history_duplicates()`. + /// - [`Config::max_history_size()`], + /// - [`Config::history_ignore_space()`], + /// - [`Config::history_duplicates()`]. #[must_use] pub fn with_config(config: Config) -> Self { Self { @@ -473,9 +473,9 @@ impl FileHistory { } /// Customized constructor with: - /// - `Config::max_history_size()`, - /// - `Config::history_ignore_space()`, - /// - `Config::history_duplicates()`. + /// - [`Config::max_history_size()`], + /// - [`Config::history_ignore_space()`], + /// - [`Config::history_duplicates()`]. #[must_use] pub fn with_config(config: Config) -> Self { Self { diff --git a/src/lib.rs b/src/lib.rs index 20dad1c68..7f97727e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -631,7 +631,8 @@ impl Editor { /// This method will read a line from STDIN and will display a `prompt`. /// - /// `prompt` should not be styled (in case the terminal doesn't support ANSI) directly: use `Highlighter::highlight_prompt` instead. + /// `prompt` should not be styled (in case the terminal doesn't support + /// ANSI) directly: use [`Highlighter::highlight_prompt`] instead. /// /// It uses terminal-style interaction if `stdin` is connected to a /// terminal. @@ -641,8 +642,8 @@ impl Editor { self.readline_with(prompt, None) } - /// This function behaves in the exact same manner as `readline`, except - /// that it pre-populates the input area. + /// This function behaves in the exact same manner as [`Editor::readline`], + /// except that it pre-populates the input area. /// /// The text that resides in the input area is given as a 2-tuple. /// The string on the left of the tuple is what will appear to the left of diff --git a/src/validate.rs b/src/validate.rs index f1475cd47..dc214b276 100644 --- a/src/validate.rs +++ b/src/validate.rs @@ -52,7 +52,7 @@ impl<'i> ValidationContext<'i> { /// /// Rustyline uses the method provided by this trait to decide whether hitting /// the enter key will end the current editing session and return the current -/// line buffer to the caller of `Editor::readline` or variants. +/// line buffer to the caller of [`crate::Editor::readline`] or variants. pub trait Validator { /// Takes the currently edited `input` and returns a /// `ValidationResult` indicating whether it is valid or not along @@ -62,8 +62,8 @@ pub trait Validator { /// delimiters are fully balanced. /// /// If you implement more complex validation checks it's probably - /// a good idea to also implement a `Hinter` to provide feedback - /// about what is invalid. + /// a good idea to also implement a [`crate::hint::Hinter`] to provide + /// feedback about what is invalid. /// /// For auto-correction like a missing closing quote or to reject invalid /// char while typing, the input will be mutable (TODO).