chore: fix some comments
Signed-off-by: riyueguang <rustruby@outlook.com>
This commit is contained in:
parent
345c94c98f
commit
8ca8ed9b07
@ -62,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for FromStrRadix10 {
|
|||||||
&& matches!(prim_ty, PrimTy::Int(_) | PrimTy::Uint(_))
|
&& matches!(prim_ty, PrimTy::Int(_) | PrimTy::Uint(_))
|
||||||
|
|
||||||
// do not lint in constant context, because the suggestion won't work.
|
// do not lint in constant context, because the suggestion won't work.
|
||||||
// NB: keep this check until a new `const_trait_impl` is available and stablized.
|
// NB: keep this check until a new `const_trait_impl` is available and stabilized.
|
||||||
&& !in_constant(cx, exp.hir_id)
|
&& !in_constant(cx, exp.hir_id)
|
||||||
{
|
{
|
||||||
let expr = if let ExprKind::AddrOf(_, _, expr) = &src.kind {
|
let expr = if let ExprKind::AddrOf(_, _, expr) = &src.kind {
|
||||||
|
@ -448,7 +448,7 @@ declare_clippy_lint! {
|
|||||||
#[clippy::version = "1.80.0"]
|
#[clippy::version = "1.80.0"]
|
||||||
pub WHILE_FLOAT,
|
pub WHILE_FLOAT,
|
||||||
nursery,
|
nursery,
|
||||||
"while loops comaparing floating point values"
|
"while loops comparing floating point values"
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
|
@ -186,7 +186,7 @@ fn already_const(header: hir::FnHeader) -> bool {
|
|||||||
fn could_be_const_with_abi(cx: &LateContext<'_>, msrv: &Msrv, abi: Abi) -> bool {
|
fn could_be_const_with_abi(cx: &LateContext<'_>, msrv: &Msrv, abi: Abi) -> bool {
|
||||||
match abi {
|
match abi {
|
||||||
Abi::Rust => true,
|
Abi::Rust => true,
|
||||||
// `const extern "C"` was stablized after 1.62.0
|
// `const extern "C"` was stabilized after 1.62.0
|
||||||
Abi::C { unwind: false } => msrv.meets(msrvs::CONST_EXTERN_FN),
|
Abi::C { unwind: false } => msrv.meets(msrvs::CONST_EXTERN_FN),
|
||||||
// Rest ABIs are still unstable and need the `const_extern_fn` feature enabled.
|
// Rest ABIs are still unstable and need the `const_extern_fn` feature enabled.
|
||||||
_ => cx.tcx.features().const_extern_fn,
|
_ => cx.tcx.features().const_extern_fn,
|
||||||
|
@ -21,8 +21,8 @@ declare_clippy_lint! {
|
|||||||
/// `PathBuf::from` instead.
|
/// `PathBuf::from` instead.
|
||||||
///
|
///
|
||||||
/// ### Known problems
|
/// ### Known problems
|
||||||
/// `.join()` introduces an implicit `clone()`. `PathBuf::from` can alternativly be
|
/// `.join()` introduces an implicit `clone()`. `PathBuf::from` can alternatively be
|
||||||
/// used when the `PathBuf` is newly constructed. This will avoild the implicit clone.
|
/// used when the `PathBuf` is newly constructed. This will avoid the implicit clone.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
@ -395,7 +395,7 @@ fn check_final_expr<'tcx>(
|
|||||||
// Returns may be used to turn an expression into a statement in rustc's AST.
|
// Returns may be used to turn an expression into a statement in rustc's AST.
|
||||||
// This allows the addition of attributes, like `#[allow]` (See: clippy#9361)
|
// This allows the addition of attributes, like `#[allow]` (See: clippy#9361)
|
||||||
// `#[expect(clippy::needless_return)]` needs to be handled separatly to
|
// `#[expect(clippy::needless_return)]` needs to be handled separatly to
|
||||||
// actually fullfil the expectation (clippy::#12998)
|
// actually fulfill the expectation (clippy::#12998)
|
||||||
match cx.tcx.hir().attrs(expr.hir_id) {
|
match cx.tcx.hir().attrs(expr.hir_id) {
|
||||||
[] => {},
|
[] => {},
|
||||||
[attr] => {
|
[attr] => {
|
||||||
|
@ -31,7 +31,7 @@ fn main() {
|
|||||||
|
|
||||||
// Don't trigger on unwrap_err on an option
|
// Don't trigger on unwrap_err on an option
|
||||||
Some(3).unwrap_err();
|
Some(3).unwrap_err();
|
||||||
Some(3).expect_err("Hellow none!");
|
Some(3).expect_err("Hello none!");
|
||||||
|
|
||||||
// Issue #11245: The `Err` variant can never be constructed so do not lint this.
|
// Issue #11245: The `Err` variant can never be constructed so do not lint this.
|
||||||
let x: Result<(), !> = Ok(());
|
let x: Result<(), !> = Ok(());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user