Skip to content

Fix typos in recent lint documentation. #11826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3609,7 +3609,7 @@ declare_clippy_lint! {

declare_clippy_lint! {
/// ### What it does
/// Checks for usage of `as_str()` on a `String`` chained with a method available on the `String` itself.
/// Checks for usage of `as_str()` on a `String` chained with a method available on the `String` itself.
///
/// ### Why is this bad?
/// The `as_str()` conversion is pointless and can be removed for simplicity and cleanliness.
Expand All @@ -3618,14 +3618,16 @@ declare_clippy_lint! {
/// ```no_run
/// # #![allow(unused)]
/// let owned_string = "This is a string".to_owned();
/// owned_string.as_str().as_bytes();
/// owned_string.as_str().as_bytes()
/// # ;
/// ```
///
/// Use instead:
/// ```no_run
/// # #![allow(unused)]
/// let owned_string = "This is a string".to_owned();
/// owned_string.as_bytes();
/// owned_string.as_bytes()
/// # ;
/// ```
#[clippy::version = "1.74.0"]
pub REDUNDANT_AS_STR,
Expand Down
13 changes: 8 additions & 5 deletions clippy_lints/src/unnecessary_map_on_constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ use rustc_span::sym;

declare_clippy_lint! {
/// ### What it does
/// Suggest removing the use of a map (or map_err) method when an Option or Result is being constructed.
/// Suggests removing the use of a `map()` (or `map_err()`) method when an `Option` or `Result`
/// is being constructed.
///
/// ### Why is this bad?
/// It introduces unnecessary complexity. In this case the function can be used directly and
/// construct the Option or Result from the output.
/// It introduces unnecessary complexity. Instead, the function can be called before
/// constructing the `Option` or `Result` from its return value.
///
/// ### Example
/// ```no_run
/// Some(4).map(i32::swap_bytes);
/// Some(4).map(i32::swap_bytes)
/// # ;
/// ```
/// Use instead:
/// ```no_run
/// Some(i32::swap_bytes(4));
/// Some(i32::swap_bytes(4))
/// # ;
/// ```
#[clippy::version = "1.74.0"]
pub UNNECESSARY_MAP_ON_CONSTRUCTOR,
Expand Down