Skip to content

Commit

Permalink
Link applicability documentation from fix factory methods
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed May 9, 2023
1 parent 6082cde commit 840475a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/ruff_diagnostics/src/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,47 +58,47 @@ impl Fix {
}
}

/// Create a new [`Fix`] with automatic applicability from an [`Edit`] element.
/// Create a new [`Fix`] with [automatic applicability](Applicability::Automatic) from an [`Edit`] element.
pub fn automatic(edit: Edit) -> Self {
Self {
edits: vec![edit],
applicability: Applicability::Automatic,
}
}

/// Create a new [`Fix`] with automatic applicability from multiple [`Edit`] elements.
/// Create a new [`Fix`] with [automatic applicability](Applicability::Automatic) from multiple [`Edit`] elements.
pub fn automatic_edits(edit: Edit, rest: impl IntoIterator<Item = Edit>) -> Self {
Self {
edits: std::iter::once(edit).chain(rest.into_iter()).collect(),
applicability: Applicability::Automatic,
}
}

/// Create a new [`Fix`] with suggsted applicability from an [`Edit`] element.
/// Create a new [`Fix`] with [suggested applicability](Applicability::Suggested) from an [`Edit`] element.
pub fn suggested(edit: Edit) -> Self {
Self {
edits: vec![edit],
applicability: Applicability::Suggested,
}
}

/// Create a new [`Fix`] with suggsted applicability from multiple [`Edit`] elements.
/// Create a new [`Fix`] with [suggested applicability](Applicability::Suggested) from multiple [`Edit`] elements.
pub fn suggested_edits(edit: Edit, rest: impl IntoIterator<Item = Edit>) -> Self {
Self {
edits: std::iter::once(edit).chain(rest.into_iter()).collect(),
applicability: Applicability::Suggested,
}
}

/// Create a new [`Fix`] with manual applicability from an [`Edit`] element.
/// Create a new [`Fix`] with [manual applicability](Applicability::Manual) from an [`Edit`] element.
pub fn manual(edit: Edit) -> Self {
Self {
edits: vec![edit],
applicability: Applicability::Manual,
}
}

/// Create a new [`Fix`] with manual applicability from multiple [`Edit`] elements.
/// Create a new [`Fix`] with [manual applicability](Applicability::Manual) from multiple [`Edit`] elements.
pub fn manual_edits(edit: Edit, rest: impl IntoIterator<Item = Edit>) -> Self {
Self {
edits: std::iter::once(edit).chain(rest.into_iter()).collect(),
Expand Down

0 comments on commit 840475a

Please sign in to comment.