Fix typos

This commit is contained in:
Catherine 2023-07-01 19:33:08 -05:00
parent c7bf05c1a4
commit 885a18207f
14 changed files with 22 additions and 20 deletions

View File

@ -174,7 +174,7 @@ The maximum amount of nesting a block can reside in
## `disallowed-names`
The list of disallowed names to lint about. NB: `bar` is not here since it has legitimate uses. The value
`".."` can be used as part of the list to indicate, that the configured values should be appended to the
`".."` can be used as part of the list to indicate that the configured values should be appended to the
default configuration of Clippy. By default, any configuration will replace the default value.
**Default Value:** `["foo", "baz", "quux"]` (`Vec<String>`)

View File

@ -11,7 +11,8 @@ use rustc_span::symbol::sym;
use super::MAP_UNWRAP_OR;
/// lint use of `map().unwrap_or_else()` for `Option`s and `Result`s
/// Return true if lint triggered
///
/// Returns true if the lint was emitted
pub(super) fn check<'tcx>(
cx: &LateContext<'tcx>,
expr: &'tcx hir::Expr<'_>,

View File

@ -25,7 +25,7 @@ declare_clippy_lint! {
/// ### Example
/// ```rust,ignore
/// for m in movies {
/// let title = m.t;
/// let title = m.t;
/// }
/// ```
/// Use instead:

View File

@ -51,7 +51,7 @@ impl EarlyLintPass for NeedlessElse {
cx,
NEEDLESS_ELSE,
span,
"this else branch is empty",
"this `else` branch is empty",
"you can remove it",
String::new(),
Applicability::MachineApplicable,

View File

@ -319,7 +319,7 @@ define_Conf! {
/// Lint: DISALLOWED_NAMES.
///
/// The list of disallowed names to lint about. NB: `bar` is not here since it has legitimate uses. The value
/// `".."` can be used as part of the list to indicate, that the configured values should be appended to the
/// `".."` can be used as part of the list to indicate that the configured values should be appended to the
/// default configuration of Clippy. By default, any configuration will replace the default value.
(disallowed_names: Vec<String> = super::DEFAULT_DISALLOWED_NAMES.iter().map(ToString::to_string).collect()),
/// Lint: SEMICOLON_INSIDE_BLOCK.

View File

@ -143,13 +143,13 @@ pub fn get_unique_attr<'a>(
unique_attr
}
/// Return true if the attributes contain any of `proc_macro`,
/// Returns true if the attributes contain any of `proc_macro`,
/// `proc_macro_derive` or `proc_macro_attribute`, false otherwise
pub fn is_proc_macro(attrs: &[ast::Attribute]) -> bool {
attrs.iter().any(rustc_ast::Attribute::is_proc_macro_attr)
}
/// Return true if the attributes contain `#[doc(hidden)]`
/// Returns true if the attributes contain `#[doc(hidden)]`
pub fn is_doc_hidden(attrs: &[ast::Attribute]) -> bool {
attrs
.iter()

View File

@ -339,7 +339,7 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
TyKind::Tup(..) => (Pat::Str("("), Pat::Str(")")),
TyKind::OpaqueDef(..) => (Pat::Str("impl"), Pat::Str("")),
TyKind::Path(qpath) => qpath_search_pat(&qpath),
// NOTE: This is missing `TraitObject`. It always return true then.
// NOTE: This is missing `TraitObject`. It will always return true then.
_ => (Pat::Str(""), Pat::Str("")),
}
}

View File

@ -1,11 +1,11 @@
//! Utility functions about comparison operators.
//! Utility functions for comparison operators.
#![deny(clippy::missing_docs_in_private_items)]
use rustc_hir::{BinOpKind, Expr};
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
/// Represent a normalized comparison operator.
/// Represents a normalized comparison operator.
pub enum Rel {
/// `<`
Lt,

View File

@ -267,7 +267,7 @@ pub fn constant_with_source<'tcx>(
res.map(|x| (x, ctxt.source))
}
/// Attempts to evaluate an expression only if it's value is not dependent on other items.
/// Attempts to evaluate an expression only if its value is not dependent on other items.
pub fn constant_simple<'tcx>(
lcx: &LateContext<'tcx>,
typeck_results: &ty::TypeckResults<'tcx>,

View File

@ -1,7 +1,7 @@
//! Utilities for evaluating whether eagerly evaluated expressions can be made lazy and vice versa.
//!
//! Things to consider:
//! - has the expression side-effects?
//! - does the expression have side-effects?
//! - is the expression computationally expensive?
//!
//! See lints:

View File

@ -13,7 +13,7 @@ use rustc_lint::LateContext;
use rustc_span::{sym, symbol, Span};
/// The essential nodes of a desugared for loop as well as the entire span:
/// `for pat in arg { body }` becomes `(pat, arg, body)`. Return `(pat, arg, body, span)`.
/// `for pat in arg { body }` becomes `(pat, arg, body)`. Returns `(pat, arg, body, span)`.
pub struct ForLoop<'tcx> {
/// `for` loop item
pub pat: &'tcx hir::Pat<'tcx>,
@ -264,7 +264,7 @@ impl<'a> Range<'a> {
}
}
/// Represent the pre-expansion arguments of a `vec!` invocation.
/// Represents the pre-expansion arguments of a `vec!` invocation.
pub enum VecArgs<'a> {
/// `vec![elem; len]`
Repeat(&'a hir::Expr<'a>, &'a hir::Expr<'a>),
@ -398,7 +398,7 @@ impl<'hir> WhileLet<'hir> {
}
}
/// Converts a hir binary operator to the corresponding `ast` type.
/// Converts a `hir` binary operator to the corresponding `ast` type.
#[must_use]
pub fn binop(op: hir::BinOpKind) -> ast::BinOpKind {
match op {
@ -436,7 +436,7 @@ pub enum VecInitKind {
WithExprCapacity(HirId),
}
/// Checks if given expression is an initialization of `Vec` and returns its kind.
/// Checks if the given expression is an initialization of `Vec` and returns its kind.
pub fn get_vec_init_kind<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Option<VecInitKind> {
if let ExprKind::Call(func, args) = expr.kind {
match func.kind {

View File

@ -823,7 +823,7 @@ fn is_default_equivalent_ctor(cx: &LateContext<'_>, def_id: DefId, path: &QPath<
false
}
/// Return true if the expr is equal to `Default::default` when evaluated.
/// Returns true if the expr is equal to `Default::default` when evaluated.
pub fn is_default_equivalent_call(cx: &LateContext<'_>, repl_func: &Expr<'_>) -> bool {
if_chain! {
if let hir::ExprKind::Path(ref repl_func_qpath) = repl_func.kind;
@ -2527,7 +2527,8 @@ pub fn span_contains_comment(sm: &SourceMap, span: Span) -> bool {
});
}
/// Return all the comments a given span contains
/// Returns all the comments a given span contains
///
/// Comments are returned wrapped with their relevant delimiters
pub fn span_extract_comment(sm: &SourceMap, span: Span) -> String {
let snippet = sm.span_to_snippet(span).unwrap_or_default();

View File

@ -395,7 +395,7 @@ fn binop_to_string(op: AssocOp, lhs: &str, rhs: &str) -> String {
}
}
/// Return `true` if `sugg` is enclosed in parenthesis.
/// Returns `true` if `sugg` is enclosed in parenthesis.
pub fn has_enclosing_paren(sugg: impl AsRef<str>) -> bool {
let mut chars = sugg.as_ref().chars();
if chars.next() == Some('(') {

View File

@ -1,4 +1,4 @@
error: this else branch is empty
error: this `else` branch is empty
--> $DIR/needless_else.rs:24:7
|
LL | } else {