mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
Auto merge of #11469 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
253f1c410b
2
.github/driver.sh
vendored
2
.github/driver.sh
vendored
@ -30,7 +30,7 @@ unset CARGO_MANIFEST_DIR
|
||||
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
|
||||
# FIXME: How to match the clippy invocation in compile-test.rs?
|
||||
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/double_neg.rs 2>double_neg.stderr && exit 1
|
||||
sed -e "s,tests/ui,\$DIR," -e "/= help/d" double_neg.stderr >normalized.stderr
|
||||
sed -e "s,tests/ui,\$DIR," -e "/= help: for/d" double_neg.stderr > normalized.stderr
|
||||
diff -u normalized.stderr tests/ui/double_neg.stderr
|
||||
|
||||
# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::ARITHMETIC_SIDE_EFFECTS;
|
||||
use clippy_utils::consts::{constant, constant_simple, Constant};
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::ty::{match_type, type_diagnostic_name};
|
||||
use clippy_utils::ty::type_diagnostic_name;
|
||||
use clippy_utils::{expr_or_init, is_from_proc_macro, is_lint_allowed, peel_hir_expr_refs, peel_hir_expr_unary};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
@ -14,7 +14,12 @@ use {rustc_ast as ast, rustc_hir as hir};
|
||||
|
||||
const HARD_CODED_ALLOWED_BINARY: &[[&str; 2]] = &[["f32", "f32"], ["f64", "f64"], ["std::string::String", "str"]];
|
||||
const HARD_CODED_ALLOWED_UNARY: &[&str] = &["f32", "f64", "std::num::Saturating", "std::num::Wrapping"];
|
||||
const INTEGER_METHODS: &[&str] = &["saturating_div", "wrapping_div", "wrapping_rem", "wrapping_rem_euclid"];
|
||||
const INTEGER_METHODS: &[Symbol] = &[
|
||||
sym::saturating_div,
|
||||
sym::wrapping_div,
|
||||
sym::wrapping_rem,
|
||||
sym::wrapping_rem_euclid,
|
||||
];
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ArithmeticSideEffects {
|
||||
@ -49,7 +54,7 @@ impl ArithmeticSideEffects {
|
||||
allowed_unary,
|
||||
const_span: None,
|
||||
expr_span: None,
|
||||
integer_methods: INTEGER_METHODS.iter().map(|el| Symbol::intern(el)).collect(),
|
||||
integer_methods: INTEGER_METHODS.iter().copied().collect(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,38 +94,35 @@ impl ArithmeticSideEffects {
|
||||
op: &Spanned<hir::BinOpKind>,
|
||||
rhs_ty: Ty<'_>,
|
||||
) -> bool {
|
||||
const SATURATING: &[&str] = &["core", "num", "saturating", "Saturating"];
|
||||
const WRAPPING: &[&str] = &["core", "num", "wrapping", "Wrapping"];
|
||||
let is_non_zero = |symbol: Option<Symbol>| {
|
||||
let is_div_or_rem = matches!(op.node, hir::BinOpKind::Div | hir::BinOpKind::Rem);
|
||||
let is_non_zero_u = |symbol: Option<Symbol>| {
|
||||
matches!(
|
||||
symbol,
|
||||
Some(
|
||||
sym::NonZeroI128
|
||||
| sym::NonZeroI16
|
||||
| sym::NonZeroI32
|
||||
| sym::NonZeroI64
|
||||
| sym::NonZeroI8
|
||||
| sym::NonZeroU128
|
||||
sym::NonZeroU128
|
||||
| sym::NonZeroU16
|
||||
| sym::NonZeroU32
|
||||
| sym::NonZeroU64
|
||||
| sym::NonZeroU8
|
||||
| sym::NonZeroUsize
|
||||
)
|
||||
)
|
||||
};
|
||||
// If the RHS is NonZero*, then division or module by zero will never occur
|
||||
if is_non_zero(type_diagnostic_name(cx, rhs_ty)) && let hir::BinOpKind::Div | hir::BinOpKind::Rem = op.node {
|
||||
let is_sat_or_wrap = |ty: Ty<'_>| {
|
||||
let is_sat = type_diagnostic_name(cx, ty) == Some(sym::Saturating);
|
||||
let is_wrap = type_diagnostic_name(cx, ty) == Some(sym::Wrapping);
|
||||
is_sat || is_wrap
|
||||
};
|
||||
|
||||
// If the RHS is NonZeroU*, then division or module by zero will never occur
|
||||
if is_non_zero_u(type_diagnostic_name(cx, rhs_ty)) && is_div_or_rem {
|
||||
return true;
|
||||
}
|
||||
// For `Saturation` or `Wrapping` (RHS), all but division and module are allowed.
|
||||
let is_div_or_rem = matches!(op.node, hir::BinOpKind::Div | hir::BinOpKind::Rem);
|
||||
if (match_type(cx, rhs_ty, SATURATING) || match_type(cx, rhs_ty, WRAPPING)) && !is_div_or_rem {
|
||||
return true;
|
||||
}
|
||||
// For `Saturation` or `Wrapping` (LHS), everything is allowed
|
||||
if match_type(cx, lhs_ty, SATURATING) || match_type(cx, lhs_ty, WRAPPING) {
|
||||
return true;
|
||||
// `Saturation` and `Wrapping` can overflow if the RHS is zero in a division or module
|
||||
if is_sat_or_wrap(lhs_ty) {
|
||||
return !is_div_or_rem;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ use rustc_lexer::{tokenize, TokenKind};
|
||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
use rustc_span::{BytePos, Pos, Span, SyntaxContext};
|
||||
use rustc_span::{BytePos, Pos, RelativeBytePos, Span, SyntaxContext};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
@ -490,7 +490,7 @@ fn item_has_safety_comment(cx: &LateContext<'_>, item: &hir::Item<'_>) -> HasSaf
|
||||
match text_has_safety_comment(
|
||||
src,
|
||||
&lines[comment_start_line.line + 1..=unsafe_line.line],
|
||||
unsafe_line.sf.start_pos.to_usize(),
|
||||
unsafe_line.sf.start_pos,
|
||||
) {
|
||||
Some(b) => HasSafetyComment::Yes(b),
|
||||
None => HasSafetyComment::No,
|
||||
@ -534,7 +534,7 @@ fn stmt_has_safety_comment(cx: &LateContext<'_>, span: Span, hir_id: HirId) -> H
|
||||
match text_has_safety_comment(
|
||||
src,
|
||||
&lines[comment_start_line.line + 1..=unsafe_line.line],
|
||||
unsafe_line.sf.start_pos.to_usize(),
|
||||
unsafe_line.sf.start_pos,
|
||||
) {
|
||||
Some(b) => HasSafetyComment::Yes(b),
|
||||
None => HasSafetyComment::No,
|
||||
@ -595,7 +595,7 @@ fn span_from_macro_expansion_has_safety_comment(cx: &LateContext<'_>, span: Span
|
||||
match text_has_safety_comment(
|
||||
src,
|
||||
&lines[macro_line.line + 1..=unsafe_line.line],
|
||||
unsafe_line.sf.start_pos.to_usize(),
|
||||
unsafe_line.sf.start_pos,
|
||||
) {
|
||||
Some(b) => HasSafetyComment::Yes(b),
|
||||
None => HasSafetyComment::No,
|
||||
@ -658,7 +658,7 @@ fn span_has_safety_comment(cx: &LateContext<'_>, span: Span) -> bool {
|
||||
body_line.line < unsafe_line.line && text_has_safety_comment(
|
||||
src,
|
||||
&lines[body_line.line + 1..=unsafe_line.line],
|
||||
unsafe_line.sf.start_pos.to_usize(),
|
||||
unsafe_line.sf.start_pos,
|
||||
).is_some()
|
||||
})
|
||||
} else {
|
||||
@ -671,13 +671,13 @@ fn span_has_safety_comment(cx: &LateContext<'_>, span: Span) -> bool {
|
||||
}
|
||||
|
||||
/// Checks if the given text has a safety comment for the immediately proceeding line.
|
||||
fn text_has_safety_comment(src: &str, line_starts: &[BytePos], offset: usize) -> Option<BytePos> {
|
||||
fn text_has_safety_comment(src: &str, line_starts: &[RelativeBytePos], start_pos: BytePos) -> Option<BytePos> {
|
||||
let mut lines = line_starts
|
||||
.array_windows::<2>()
|
||||
.rev()
|
||||
.map_while(|[start, end]| {
|
||||
let start = start.to_usize() - offset;
|
||||
let end = end.to_usize() - offset;
|
||||
let start = start.to_usize();
|
||||
let end = end.to_usize();
|
||||
let text = src.get(start..end)?;
|
||||
let trimmed = text.trim_start();
|
||||
Some((start + (text.len() - trimmed.len()), trimmed))
|
||||
@ -692,9 +692,7 @@ fn text_has_safety_comment(src: &str, line_starts: &[BytePos], offset: usize) ->
|
||||
let (mut line, mut line_start) = (line, line_start);
|
||||
loop {
|
||||
if line.to_ascii_uppercase().contains("SAFETY:") {
|
||||
return Some(BytePos(
|
||||
u32::try_from(line_start).unwrap() + u32::try_from(offset).unwrap(),
|
||||
));
|
||||
return Some(start_pos + BytePos(u32::try_from(line_start).unwrap()));
|
||||
}
|
||||
match lines.next() {
|
||||
Some((s, x)) if x.starts_with("//") => (line, line_start) = (x, s),
|
||||
@ -707,15 +705,13 @@ fn text_has_safety_comment(src: &str, line_starts: &[BytePos], offset: usize) ->
|
||||
let (mut line_start, mut line) = (line_start, line);
|
||||
loop {
|
||||
if line.starts_with("/*") {
|
||||
let src = &src[line_start..line_starts.last().unwrap().to_usize() - offset];
|
||||
let src = &src[line_start..line_starts.last().unwrap().to_usize()];
|
||||
let mut tokens = tokenize(src);
|
||||
return (src[..tokens.next().unwrap().len as usize]
|
||||
.to_ascii_uppercase()
|
||||
.contains("SAFETY:")
|
||||
&& tokens.all(|t| t.kind == TokenKind::Whitespace))
|
||||
.then_some(BytePos(
|
||||
u32::try_from(line_start).unwrap() + u32::try_from(offset).unwrap(),
|
||||
));
|
||||
.then_some(start_pos + BytePos(u32::try_from(line_start).unwrap()));
|
||||
}
|
||||
match lines.next() {
|
||||
Some(x) => (line_start, line) = x,
|
||||
|
@ -292,7 +292,7 @@ fn check_terminator<'tcx>(
|
||||
| TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::UnwindTerminate
|
||||
| TerminatorKind::UnwindTerminate(_)
|
||||
| TerminatorKind::Unreachable => Ok(()),
|
||||
TerminatorKind::Drop { place, .. } => {
|
||||
if !is_ty_const_destruct(tcx, place.ty(&body.local_decls, tcx).ty, body) {
|
||||
|
@ -8,7 +8,7 @@ use rustc_hir::{BlockCheckMode, Expr, ExprKind, UnsafeSource};
|
||||
use rustc_lint::{LateContext, LintContext};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::source_map::{original_sp, SourceMap};
|
||||
use rustc_span::{hygiene, BytePos, Pos, SourceFile, Span, SpanData, SyntaxContext, DUMMY_SP};
|
||||
use rustc_span::{hygiene, BytePos, Pos, SourceFile, SourceFileAndLine, Span, SpanData, SyntaxContext, DUMMY_SP};
|
||||
use std::borrow::Cow;
|
||||
use std::ops::Range;
|
||||
|
||||
@ -117,9 +117,9 @@ fn first_char_in_first_line<T: LintContext>(cx: &T, span: Span) -> Option<BytePo
|
||||
/// ```
|
||||
fn line_span<T: LintContext>(cx: &T, span: Span) -> Span {
|
||||
let span = original_sp(span, DUMMY_SP);
|
||||
let source_map_and_line = cx.sess().source_map().lookup_line(span.lo()).unwrap();
|
||||
let line_no = source_map_and_line.line;
|
||||
let line_start = source_map_and_line.sf.lines(|lines| lines[line_no]);
|
||||
let SourceFileAndLine { sf, line } = cx.sess().source_map().lookup_line(span.lo()).unwrap();
|
||||
let line_start = sf.lines(|lines| lines[line]);
|
||||
let line_start = sf.absolute_position(line_start);
|
||||
span.with_lo(line_start)
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2023-08-24"
|
||||
channel = "nightly-2023-09-07"
|
||||
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
||||
|
@ -1,6 +1,7 @@
|
||||
error: package `cargo_common_metadata_fail` is missing `package.description` metadata
|
||||
|
|
||||
= note: `-D clippy::cargo-common-metadata` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cargo_common_metadata)]`
|
||||
|
||||
error: package `cargo_common_metadata_fail` is missing `either package.license or package.license_file` metadata
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
error: package `cargo_common_metadata_fail_publish` is missing `package.description` metadata
|
||||
|
|
||||
= note: `-D clippy::cargo-common-metadata` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cargo_common_metadata)]`
|
||||
|
||||
error: package `cargo_common_metadata_fail_publish` is missing `either package.license or package.license_file` metadata
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
error: package `cargo_common_metadata_fail_publish_true` is missing `package.description` metadata
|
||||
|
|
||||
= note: `-D clippy::cargo-common-metadata` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cargo_common_metadata)]`
|
||||
|
||||
error: package `cargo_common_metadata_fail_publish_true` is missing `either package.license or package.license_file` metadata
|
||||
|
||||
|
@ -9,6 +9,7 @@ error: file is loaded as a module multiple times: `src/b.rs`
|
||||
|
|
||||
= help: replace all but one `mod` item with `use` items
|
||||
= note: `-D clippy::duplicate-mod` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::duplicate_mod)]`
|
||||
|
||||
error: file is loaded as a module multiple times: `src/c.rs`
|
||||
--> src/main.rs:9:1
|
||||
|
@ -2,6 +2,7 @@ error: the "no-" prefix in the feature name "no-qaq" is negative
|
||||
|
|
||||
= help: consider renaming the feature to "qaq", but make sure the feature adds functionality
|
||||
= note: `-D clippy::negative-feature-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::negative_feature_names)]`
|
||||
|
||||
error: the "no_" prefix in the feature name "no_qaq" is negative
|
||||
|
|
||||
@ -19,6 +20,7 @@ error: the "-support" suffix in the feature name "qvq-support" is redundant
|
||||
|
|
||||
= help: consider renaming the feature to "qvq"
|
||||
= note: `-D clippy::redundant-feature-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::redundant_feature_names)]`
|
||||
|
||||
error: the "_support" suffix in the feature name "qvq_support" is redundant
|
||||
|
|
||||
|
@ -6,6 +6,7 @@ error: `mod.rs` files are required, found `src/bad/inner.rs`
|
||||
|
|
||||
= help: move `src/bad/inner.rs` to `src/bad/inner/mod.rs`
|
||||
= note: `-D clippy::self-named-module-files` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::self_named_module_files)]`
|
||||
|
||||
error: `mod.rs` files are required, found `src/bad/inner/stuff.rs`
|
||||
--> src/bad/inner/stuff.rs:1:1
|
||||
|
@ -6,5 +6,6 @@ error: `mod.rs` files are required, found `src/bad.rs`
|
||||
|
|
||||
= help: move `src/bad.rs` to `src/bad/mod.rs`
|
||||
= note: `-D clippy::self-named-module-files` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::self_named_module_files)]`
|
||||
|
||||
error: could not compile `fail-mod-remap` (bin "fail-mod-remap") due to previous error
|
||||
|
@ -6,5 +6,6 @@ error: `mod.rs` files are not allowed, found `src/bad/mod.rs`
|
||||
|
|
||||
= help: move `src/bad/mod.rs` to `src/bad.rs`
|
||||
= note: `-D clippy::mod-module-files` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::mod_module_files)]`
|
||||
|
||||
error: could not compile `fail-no-mod` (bin "fail-no-mod") due to previous error
|
||||
|
@ -1,5 +1,6 @@
|
||||
error: multiple versions for dependency `winapi`: 0.2.8, 0.3.9
|
||||
|
|
||||
= note: `-D clippy::multiple-crate-versions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::multiple_crate_versions)]`
|
||||
|
||||
error: could not compile `multiple_crate_versions` (bin "multiple_crate_versions") due to previous error
|
||||
|
@ -1,5 +1,6 @@
|
||||
error: wildcard dependency for `regex`
|
||||
|
|
||||
= note: `-D clippy::wildcard-dependencies` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::wildcard_dependencies)]`
|
||||
|
||||
error: could not compile `wildcard_dependencies` (bin "wildcard_dependencies") due to previous error
|
||||
|
@ -6,6 +6,7 @@ LL | /// Check for lint formulations that are correct
|
||||
|
|
||||
= help: try using `Checks for` instead
|
||||
= note: `-D clippy::almost-standard-lint-formulation` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::almost_standard_lint_formulation)]`
|
||||
|
||||
error: non-standard lint formulation
|
||||
--> $DIR/check_formulation.rs:33:5
|
||||
|
@ -16,6 +16,7 @@ help: this `let` statement can also be in the `if_chain!`
|
||||
LL | let x = "";
|
||||
| ^^^^^^^^^^^
|
||||
= note: `-D clippy::if-chain-style` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::if_chain_style)]`
|
||||
|
||||
error: `if a && b;` should be `if a; if b;`
|
||||
--> $DIR/if_chain_style.rs:24:12
|
||||
|
@ -5,6 +5,7 @@ LL | pub const TRANSMUTE: [&str; 4] = ["core", "intrinsics", "", "transmute"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::invalid-paths` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::invalid_paths)]`
|
||||
|
||||
error: invalid path
|
||||
--> $DIR/invalid_paths.rs:18:5
|
||||
|
@ -6,6 +6,7 @@ LL | const DEREF_TRAIT: [&str; 4] = ["core", "ops", "deref", "Deref"];
|
||||
|
|
||||
= help: convert all references to use `sym::Deref`
|
||||
= note: `-D clippy::unnecessary-def-path` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_def_path)]`
|
||||
|
||||
error: hardcoded path to a language item
|
||||
--> $DIR/unnecessary_def_path_hardcoded_path.rs:11:40
|
||||
|
@ -5,6 +5,7 @@ LL | std::f32::MAX;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::absolute-paths` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::absolute_paths)]`
|
||||
|
||||
error: consider bringing this path into scope with the `use` keyword
|
||||
--> $DIR/absolute_paths.rs:41:5
|
||||
|
@ -5,6 +5,7 @@ LL | std::f32::MAX;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::absolute-paths` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::absolute_paths)]`
|
||||
|
||||
error: consider bringing this path into scope with the `use` keyword
|
||||
--> $DIR/absolute_paths.rs:41:5
|
||||
|
@ -5,6 +5,7 @@ LL | println!("val='{}'", local_i32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::uninlined-format-args` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]`
|
||||
help: change this to
|
||||
|
|
||||
LL - println!("val='{}'", local_i32);
|
||||
@ -30,6 +31,7 @@ LL | println!("Hello {} is {:.*}", "x", local_i32, local_f64);
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::print-literal` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::print_literal)]`
|
||||
help: try
|
||||
|
|
||||
LL - println!("Hello {} is {:.*}", "x", local_i32, local_f64);
|
||||
|
@ -5,6 +5,7 @@ LL | let _ = Baz + Baz;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> $DIR/arithmetic_side_effects_allowed.rs:80:13
|
||||
|
@ -7,6 +7,7 @@ LL | const ABOVE: [u8; 11] = [0; 11];
|
||||
| help: make this a static item: `static`
|
||||
|
|
||||
= note: `-D clippy::large-const-arrays` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_const_arrays)]`
|
||||
|
||||
error: allocating a local array larger than 10 bytes
|
||||
--> $DIR/array_size_threshold.rs:4:25
|
||||
@ -16,6 +17,7 @@ LL | const ABOVE: [u8; 11] = [0; 11];
|
||||
|
|
||||
= help: consider allocating on the heap with `vec![0; 11].into_boxed_slice()`
|
||||
= note: `-D clippy::large-stack-arrays` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_stack_arrays)]`
|
||||
|
||||
error: allocating a local array larger than 10 bytes
|
||||
--> $DIR/array_size_threshold.rs:8:17
|
||||
|
@ -6,6 +6,7 @@ LL | let _x = String::from("hello");
|
||||
|
|
||||
= note: strings are bad (from clippy.toml)
|
||||
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_invalid_type)]`
|
||||
|
||||
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
|
||||
--> $DIR/await_holding_invalid_type.rs:10:9
|
||||
|
@ -18,6 +18,7 @@ LL | fn cognitive_complexity() {
|
||||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cognitive_complexity)]`
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
|
@ -5,6 +5,7 @@ LL | if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::dbg-macro` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::dbg_macro)]`
|
||||
help: remove the invocation before committing it to a version control system
|
||||
|
|
||||
LL | if let Some(n) = n.checked_sub(4) { n } else { n }
|
||||
|
@ -5,6 +5,7 @@ LL | println!("one");
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-macros` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_macros)]`
|
||||
|
||||
error: use of a disallowed macro `std::println`
|
||||
--> $DIR/disallowed_macros.rs:11:5
|
||||
|
@ -5,6 +5,7 @@ LL | let foo = "bar";
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_names)]`
|
||||
|
||||
error: use of a disallowed/placeholder name `ducks`
|
||||
--> $DIR/disallowed_names.rs:7:9
|
||||
|
@ -5,6 +5,7 @@ LL | let ducks = ["quack", "quack"];
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_names)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,6 +5,7 @@ LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and sh
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
|
||||
help: try
|
||||
|
|
||||
LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
|
||||
|
@ -5,6 +5,7 @@ LL | /// OAuth and LaTeX are inside Clippy's default list.
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
|
||||
help: try
|
||||
|
|
||||
LL | /// `OAuth` and LaTeX are inside Clippy's default list.
|
||||
|
@ -6,6 +6,7 @@ LL | let w = { 3 };
|
||||
|
|
||||
= help: try refactoring your code to minimize nesting
|
||||
= note: `-D clippy::excessive-nesting` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::excessive_nesting)]`
|
||||
|
||||
error: this block is too nested
|
||||
--> $DIR/excessive_nesting.rs:67:17
|
||||
|
@ -6,6 +6,7 @@ LL | let _ = opt.expect("");
|
||||
|
|
||||
= note: if this value is `None`, it will panic
|
||||
= note: `-D clippy::expect-used` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::expect_used)]`
|
||||
|
||||
error: used `expect()` on a `Result` value
|
||||
--> $DIR/expect_used.rs:12:13
|
||||
|
@ -6,6 +6,7 @@ LL | fn g(_: bool, _: bool) {}
|
||||
|
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::fn_params_excessive_bools)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,6 +8,7 @@ LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::too-many-lines` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::too_many_lines)]`
|
||||
|
||||
error: this function has too many lines (4/1)
|
||||
--> $DIR/test.rs:25:1
|
||||
|
@ -10,6 +10,7 @@ note: same as this
|
||||
LL | if x.get() {
|
||||
| ^^^^^^^
|
||||
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::ifs_same_cond)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,6 +5,7 @@ LL | should_warn().await;
|
||||
| ^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(should_warn())`
|
||||
|
|
||||
= note: `-D clippy::large-futures` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_futures)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -6,6 +6,7 @@ LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
|
||||
|
|
||||
= note: the configuration allows a maximum size of 600 bytes
|
||||
= note: `-D clippy::large-include-file` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_include_file)]`
|
||||
= note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: attempted to include a large file
|
||||
|
@ -5,6 +5,7 @@ LL | let _fail1 = 100_200_300.123456789;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`
|
||||
|
|
||||
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inconsistent_digit_grouping)]`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/test.rs:22:18
|
||||
@ -13,6 +14,7 @@ LL | let _fail2 = 100200300.300200100;
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.300_200_100`
|
||||
|
|
||||
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -5,6 +5,7 @@ LL | use extern_types::Aaa;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::min-ident-chars` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::min_ident_chars)]`
|
||||
|
||||
error: this ident is too short (3 <= 3)
|
||||
--> $DIR/min_ident_chars.rs:10:5
|
||||
|
@ -5,6 +5,7 @@ LL | let _: Option<u64> = Some(&16).map(|b| *b);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `Some(&16).cloned()`
|
||||
|
|
||||
= note: `-D clippy::map-clone` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::map_clone)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,6 +5,7 @@ LL | use std::process::{exit as wrong_exit, Child as Kid};
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `exit as goodbye`
|
||||
|
|
||||
= note: `-D clippy::missing-enforced-import-renames` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::missing_enforced_import_renames)]`
|
||||
|
||||
error: this import should be renamed
|
||||
--> $DIR/conf_missing_enforced_import_rename.rs:6:1
|
||||
|
@ -7,6 +7,7 @@ LL | | }
|
||||
| |_________^
|
||||
|
|
||||
= note: `-D clippy::module-inception` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::module_inception)]`
|
||||
|
||||
error: module has the same name as its containing module
|
||||
--> $DIR/module_inception.rs:11:5
|
||||
|
@ -5,6 +5,7 @@ LL | let _ = vec! {1, 2, 3};
|
||||
| ^^^^^^^^^^^^^^ help: consider writing: `vec![1, 2, 3]`
|
||||
|
|
||||
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::nonstandard_macro_braces)]`
|
||||
|
||||
error: use of irregular braces for `format!` macro
|
||||
--> $DIR/conf_nonstandard_macro_braces.rs:44:13
|
||||
|
@ -5,6 +5,7 @@ LL | print!("{n}");
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::print-stdout` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::print_stdout)]`
|
||||
|
||||
error: use of `eprint!`
|
||||
--> $DIR/print_macro.rs:7:5
|
||||
@ -13,6 +14,7 @@ LL | eprint!("{n}");
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::print-stderr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::print_stderr)]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -5,6 +5,7 @@ LL | pub(crate) fn crate_no_docs() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::missing_docs_in_private_items)]`
|
||||
|
||||
error: missing documentation for a function
|
||||
--> $DIR/pub_crate_missing_doc.rs:15:5
|
||||
|
@ -5,6 +5,7 @@ LL | { unit_fn_block(); }
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::semicolon-outside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_outside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL - { unit_fn_block(); }
|
||||
@ -33,6 +34,7 @@ LL | | };
|
||||
| |______^
|
||||
|
|
||||
= note: `-D clippy::semicolon-inside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_inside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL ~ unit_fn_block();
|
||||
|
@ -8,6 +8,7 @@ LL | | };
|
||||
| |______^
|
||||
|
|
||||
= note: `-D clippy::semicolon-inside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_inside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL ~ unit_fn_block();
|
||||
|
@ -5,6 +5,7 @@ LL | { unit_fn_block(); }
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::semicolon-outside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_outside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL - { unit_fn_block(); }
|
||||
|
@ -11,6 +11,7 @@ LL | rc_is_not_send: Rc<String>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: use a thread-safe type that implements `Send`
|
||||
= note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::non_send_fields_in_send_ty)]`
|
||||
|
||||
error: some fields in `MultiField<T>` are not safe to be sent to another thread
|
||||
--> $DIR/test.rs:19:1
|
||||
|
@ -8,6 +8,7 @@ LL | | }
|
||||
|
|
||||
= help: consider using a state machine or refactoring bools into two-variant enums
|
||||
= note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::struct_excessive_bools)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -18,6 +18,7 @@ LL | x[index];
|
||||
|
|
||||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:46:5
|
||||
|
@ -5,6 +5,7 @@ LL | fn test(toto: ()) {}
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_names)]`
|
||||
|
||||
error: use of a disallowed/placeholder name `toto`
|
||||
--> $DIR/conf_french_disallowed_name.rs:9:9
|
||||
|
@ -5,6 +5,7 @@ LL | let re = Regex::new(r"ab.*c").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-methods` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_methods)]`
|
||||
|
||||
error: use of a disallowed method `regex::Regex::is_match`
|
||||
--> $DIR/conf_disallowed_methods.rs:36:5
|
||||
|
@ -5,6 +5,7 @@ LL | use std::sync::atomic::AtomicU32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-types` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_types)]`
|
||||
|
||||
error: `std::time::Instant` is not allowed according to config
|
||||
--> $DIR/conf_disallowed_types.rs:8:1
|
||||
|
@ -5,6 +5,7 @@ LL | fn bad(x: &u16, y: &Foo) {}
|
||||
| ^^^^ help: consider passing by value instead: `u16`
|
||||
|
|
||||
= note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/test.rs:15:20
|
||||
|
@ -6,6 +6,7 @@ LL | /* Safety: */ unsafe {}
|
||||
|
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
= note: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> $DIR/undocumented_unsafe_blocks.rs:267:5
|
||||
@ -251,6 +252,7 @@ help: consider removing the safety comment
|
||||
LL | // SAFETY:
|
||||
| ^^^^^^^^^^
|
||||
= note: `-D clippy::unnecessary-safety-comment` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> $DIR/undocumented_unsafe_blocks.rs:473:5
|
||||
|
@ -5,6 +5,7 @@ LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&boxed_slice[1]`
|
||||
|
|
||||
= note: `-D clippy::get-unwrap` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::get_unwrap)]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:38:17
|
||||
@ -15,6 +16,7 @@ LL | let _ = boxed_slice.get(1).unwrap();
|
||||
= note: if this value is `None`, it will panic
|
||||
= help: consider using `expect()` to provide a better panic message
|
||||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unwrap_used)]`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:39:17
|
||||
|
@ -5,6 +5,7 @@ LL | struct HTTPResponse; // not linted by default, but with cfg option
|
||||
| ^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `HttpResponse`
|
||||
|
|
||||
= note: `-D clippy::upper-case-acronyms` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::upper_case_acronyms)]`
|
||||
|
||||
error: name `NS` contains a capitalized acronym
|
||||
--> $DIR/upper_case_acronyms.rs:8:5
|
||||
|
@ -5,6 +5,7 @@ LL | struct Foo(Vec<Box<u8>>);
|
||||
| ^^^^^^^^^^^^ help: try: `Vec<u8>`
|
||||
|
|
||||
= note: `-D clippy::vec-box` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::vec_box)]`
|
||||
|
||||
error: `Vec<T>` is already on the heap, the boxing is unnecessary
|
||||
--> $DIR/test.rs:10:12
|
||||
|
@ -6,6 +6,7 @@ LL | u <= 0;
|
||||
|
|
||||
= help: because `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == 0` instead
|
||||
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::absurd_extreme_comparisons)]`
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:16:5
|
||||
|
@ -5,6 +5,7 @@ LL | #[allow(dead_code)]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
|
|
||||
= note: `-D clippy::allow-attributes` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]`
|
||||
|
||||
error: #[allow] attribute found
|
||||
--> $DIR/allow_attributes.rs:22:30
|
||||
|
@ -7,6 +7,7 @@ LL | let _ = ('a') ..'z';
|
||||
| help: use an inclusive range: `..=`
|
||||
|
|
||||
= note: `-D clippy::almost-complete-range` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]`
|
||||
|
||||
error: almost complete ascii range
|
||||
--> $DIR/almost_complete_range.rs:19:17
|
||||
|
@ -6,6 +6,7 @@ LL | let my_e = 2.7182;
|
||||
|
|
||||
= help: consider using the constant directly
|
||||
= note: `-D clippy::approx-constant` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::approx_constant)]`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::E` found
|
||||
--> $DIR/approx_const.rs:6:20
|
||||
|
@ -8,6 +8,7 @@ LL | let _ = Arc::new(RefCell::new(42));
|
||||
= note: required for `Arc<RefCell<i32>>` to implement `Send` and `Sync`
|
||||
= help: consider using an `Rc` instead or wrapping the inner type with a `Mutex`
|
||||
= note: `-D clippy::arc-with-non-send-sync` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::arc_with_non_send_sync)]`
|
||||
|
||||
error: usage of an `Arc` that is not `Send` or `Sync`
|
||||
--> $DIR/arc_with_non_send_sync.rs:40:13
|
||||
|
@ -5,6 +5,7 @@ LL | _n += 1;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> $DIR/arithmetic_side_effects.rs:305:5
|
||||
@ -703,16 +704,16 @@ LL | 10 / a
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> $DIR/arithmetic_side_effects.rs:498:9
|
||||
--> $DIR/arithmetic_side_effects.rs:512:9
|
||||
|
|
||||
LL | unsigned / nonzero_unsigned
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | x / maybe_zero
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> $DIR/arithmetic_side_effects.rs:502:9
|
||||
--> $DIR/arithmetic_side_effects.rs:516:9
|
||||
|
|
||||
LL | unsigned % nonzero_unsigned
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | x % maybe_zero
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 119 previous errors
|
||||
|
||||
|
@ -6,6 +6,7 @@ LL | let i = 0u32 as u64;
|
||||
|
|
||||
= help: consider using a safe wrapper for this conversion
|
||||
= note: `-D clippy::as-conversions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::as_conversions)]`
|
||||
|
||||
error: using a potentially dangerous silent `as` conversion
|
||||
--> $DIR/as_conversions.rs:12:13
|
||||
|
@ -5,6 +5,7 @@ LL | let _ = string.as_ptr() as *mut u8;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `string.as_mut_ptr()`
|
||||
|
|
||||
= note: `-D clippy::as-ptr-cast-mut` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::as_ptr_cast_mut)]`
|
||||
|
||||
error: casting the result of `as_ptr` to *mut i8
|
||||
--> $DIR/as_ptr_cast_mut.rs:25:22
|
||||
|
@ -7,6 +7,7 @@ LL | foo(n as _);
|
||||
| help: consider giving the type explicitly: `usize`
|
||||
|
|
||||
= note: `-D clippy::as-underscore` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::as_underscore)]`
|
||||
|
||||
error: using `as _` conversion
|
||||
--> $DIR/as_underscore.rs:10:18
|
||||
|
@ -6,6 +6,7 @@ LL | asm!("");
|
||||
|
|
||||
= help: use AT&T x86 assembly syntax
|
||||
= note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_intel_syntax)]`
|
||||
|
||||
error: Intel x86 assembly syntax used
|
||||
--> $DIR/asm_syntax.rs:10:9
|
||||
@ -31,6 +32,7 @@ LL | asm!("", options(att_syntax));
|
||||
|
|
||||
= help: use Intel x86 assembly syntax
|
||||
= note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_att_syntax)]`
|
||||
|
||||
error: AT&T x86 assembly syntax used
|
||||
--> $DIR/asm_syntax.rs:28:9
|
||||
|
@ -6,6 +6,7 @@ LL | assert!(true);
|
||||
|
|
||||
= help: remove it
|
||||
= note: `-D clippy::assertions-on-constants` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assertions_on_constants)]`
|
||||
|
||||
error: `assert!(false)` should probably be replaced
|
||||
--> $DIR/assertions_on_constants.rs:12:5
|
||||
|
@ -5,6 +5,7 @@ LL | assert!(r.is_ok());
|
||||
| ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()`
|
||||
|
|
||||
= note: `-D clippy::assertions-on-result-states` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assertions_on_result_states)]`
|
||||
|
||||
error: called `assert!` with `Result::is_ok`
|
||||
--> $DIR/assertions_on_result_states.rs:42:5
|
||||
|
@ -5,6 +5,7 @@ LL | a = a + 1;
|
||||
| ^^^^^^^^^ help: replace it with: `a += 1`
|
||||
|
|
||||
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:8:5
|
||||
|
@ -5,6 +5,7 @@ LL | a += a + 1;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::misrefactored-assign-op` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::misrefactored_assign_op)]`
|
||||
help: did you mean `a = a + 1` or `a = a + a + 1`? Consider replacing it with
|
||||
|
|
||||
LL | a += 1;
|
||||
@ -141,6 +142,7 @@ LL | buf = buf + cows.clone();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`
|
||||
|
|
||||
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
|
@ -11,6 +11,7 @@ LL | | };
|
||||
| |______- outer async construct
|
||||
|
|
||||
= note: `-D clippy::async-yields-async` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::async_yields_async)]`
|
||||
help: consider awaiting this value
|
||||
|
|
||||
LL ~ async {
|
||||
|
@ -5,6 +5,7 @@ LL | #[inline(always)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::inline-always` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inline_always)]`
|
||||
|
||||
error: the since field must contain a semver-compliant version
|
||||
--> $DIR/attrs.rs:27:14
|
||||
@ -13,6 +14,7 @@ LL | #[deprecated(since = "forever")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::deprecated-semver` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::deprecated_semver)]`
|
||||
|
||||
error: the since field must contain a semver-compliant version
|
||||
--> $DIR/attrs.rs:32:14
|
||||
|
@ -14,6 +14,7 @@ LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_lock)]`
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:25:13
|
||||
|
@ -14,6 +14,7 @@ LL | | baz().await
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_refcell_ref)]`
|
||||
|
||||
error: this `RefCell` reference is held across an `await` point
|
||||
--> $DIR/await_holding_refcell_ref.rs:12:9
|
||||
|
@ -5,6 +5,7 @@ LL | x & 0 == 0;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::bad-bit-mask` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bad_bit_mask)]`
|
||||
|
||||
error: this operation will always return zero. This is likely not the intended outcome
|
||||
--> $DIR/bit_masks.rs:14:5
|
||||
@ -87,6 +88,7 @@ LL | x | 1 > 3;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::ineffective-bit-mask` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::ineffective_bit_mask)]`
|
||||
|
||||
error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly
|
||||
--> $DIR/bit_masks.rs:72:5
|
||||
|
@ -3,6 +3,7 @@ error: `clippy::restriction` is not meant to be enabled as a group
|
||||
= note: because of the command line `--warn clippy::restriction`
|
||||
= help: enable the restriction lints you need individually
|
||||
= note: `-D clippy::blanket-clippy-restriction-lints` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::blanket_clippy_restriction_lints)]`
|
||||
|
||||
error: `clippy::restriction` is not meant to be enabled as a group
|
||||
--> $DIR/blanket_clippy_restriction_lints.rs:6:9
|
||||
|
@ -8,6 +8,7 @@ LL | | } {
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::blocks-in-if-conditions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::blocks_in_if_conditions)]`
|
||||
help: try
|
||||
|
|
||||
LL ~ let res = {
|
||||
@ -29,6 +30,7 @@ LL | if true && x == 3 { 6 } else { 10 }
|
||||
| ^^^^^^^^^^^^^^ help: try: `x == 3`
|
||||
|
|
||||
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -11,6 +11,7 @@ LL | | },
|
||||
| |_____________^
|
||||
|
|
||||
= note: `-D clippy::blocks-in-if-conditions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::blocks_in_if_conditions)]`
|
||||
|
||||
error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
|
||||
--> $DIR/blocks_in_if_conditions_closure.rs:34:13
|
||||
|
@ -5,6 +5,7 @@ LL | assert_eq!("a".is_empty(), false);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::bool-assert-comparison` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bool_assert_comparison)]`
|
||||
help: replace it with `assert!(..)`
|
||||
|
|
||||
LL - assert_eq!("a".is_empty(), false);
|
||||
|
@ -5,6 +5,7 @@ LL | if x == true {
|
||||
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
||||
|
|
||||
= note: `-D clippy::bool-comparison` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]`
|
||||
|
||||
error: equality checks against false can be replaced by a negation
|
||||
--> $DIR/bool_comparison.rs:12:8
|
||||
|
@ -10,6 +10,7 @@ LL | | };
|
||||
|
|
||||
= note: `a as i32` or `a.into()` can also be valid options
|
||||
= note: `-D clippy::bool-to-int-with-if` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bool_to_int_with_if)]`
|
||||
|
||||
error: boolean to int conversion using if
|
||||
--> $DIR/bool_to_int_with_if.rs:19:5
|
||||
|
@ -5,6 +5,7 @@ LL | let _p = &val as *const i32;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of!(val)`
|
||||
|
|
||||
= note: `-D clippy::borrow-as-ptr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]`
|
||||
|
||||
error: borrow as raw pointer
|
||||
--> $DIR/borrow_as_ptr.rs:17:18
|
||||
|
@ -5,6 +5,7 @@ LL | let _p = &val as *const i32;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::addr_of!(val)`
|
||||
|
|
||||
= note: `-D clippy::borrow-as-ptr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]`
|
||||
|
||||
error: borrow as raw pointer
|
||||
--> $DIR/borrow_as_ptr_no_std.rs:11:18
|
||||
|
@ -5,6 +5,7 @@ LL | let b = &*a;
|
||||
| ^^^ help: if you would like to reborrow, try removing `&*`: `a`
|
||||
|
|
||||
= note: `-D clippy::borrow-deref-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_deref_ref)]`
|
||||
|
||||
error: deref on an immutable reference
|
||||
--> $DIR/borrow_deref_ref.rs:15:22
|
||||
|
@ -5,6 +5,7 @@ LL | let x: &str = &*s;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::borrow-deref-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_deref_ref)]`
|
||||
help: if you would like to reborrow, try removing `&*`
|
||||
|
|
||||
LL | let x: &str = s;
|
||||
|
@ -6,6 +6,7 @@ LL | fn test1(foo: Box<Vec<bool>>) {}
|
||||
|
|
||||
= help: `Vec<..>` is already on the heap, `Box<Vec<..>>` makes an extra allocation
|
||||
= note: `-D clippy::box-collection` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::box_collection)]`
|
||||
|
||||
error: you seem to be trying to use `Box<String>`. Consider using just `String`
|
||||
--> $DIR/box_collection.rs:29:15
|
||||
|
@ -5,6 +5,7 @@ LL | let _string: Box<String> = Box::new(Default::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
||||
|
|
||||
= note: `-D clippy::box-default` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::box_default)]`
|
||||
|
||||
error: `Box::new(_)` of default value
|
||||
--> $DIR/box_default.rs:23:17
|
||||
|
@ -5,6 +5,7 @@ LL | fn warn_arg(x: Box<A>) {
|
||||
| ^
|
||||
|
|
||||
= note: `-D clippy::boxed-local` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::boxed_local)]`
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> $DIR/boxed_local.rs:123:12
|
||||
|
@ -5,6 +5,7 @@ LL | fn foo<u32>(a: u32) -> u32 {
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::builtin-type-shadow` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::builtin_type_shadow)]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/builtin_type_shadow.rs:5:5
|
||||
|
@ -5,6 +5,7 @@ LL | let _ = String::from("foo").bytes().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.len()` instead: `String::from("foo").len()`
|
||||
|
|
||||
= note: `-D clippy::bytes-count-to-len` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bytes_count_to_len)]`
|
||||
|
||||
error: using long and hard to read `.bytes().count()`
|
||||
--> $DIR/bytes_count_to_len.rs:10:13
|
||||
|
@ -5,6 +5,7 @@ LL | let _ = s.bytes().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^ help: try: `s.as_bytes().get(3).copied()`
|
||||
|
|
||||
= note: `-D clippy::bytes-nth` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bytes_nth)]`
|
||||
|
||||
error: called `.bytes().nth().unwrap()` on a `String`
|
||||
--> $DIR/bytes_nth.rs:7:14
|
||||
|
@ -6,6 +6,7 @@ LL | filename.ends_with(".rs")
|
||||
|
|
||||
= help: consider using a case-insensitive comparison instead
|
||||
= note: `-D clippy::case-sensitive-file-extension-comparisons` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::case_sensitive_file_extension_comparisons)]`
|
||||
help: use std::path::Path
|
||||
|
|
||||
LL ~ std::path::Path::new(filename)
|
||||
|
@ -5,6 +5,7 @@ LL | x0 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
||||
|
||||
error: casting `i64` to `f32` causes a loss of precision (`i64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:20:5
|
||||
@ -44,6 +45,7 @@ LL | 1f32 as i32;
|
||||
|
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
|
||||
|
||||
error: casting `f32` to `u32` may truncate the value
|
||||
--> $DIR/cast.rs:35:5
|
||||
@ -60,6 +62,7 @@ LL | 1f32 as u32;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-sign-loss` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_sign_loss)]`
|
||||
|
||||
error: casting `f64` to `f32` may truncate the value
|
||||
--> $DIR/cast.rs:39:5
|
||||
@ -190,6 +193,7 @@ LL | 1u8 as i8;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
||||
|
||||
error: casting `u16` to `i16` may wrap around the value
|
||||
--> $DIR/cast.rs:69:5
|
||||
@ -360,6 +364,7 @@ LL | let _ = Self::B as u8;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-enum-truncation` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_enum_truncation)]`
|
||||
|
||||
error: casting `main::E5` to `i8` may truncate the value
|
||||
--> $DIR/cast.rs:260:21
|
||||
|
@ -5,6 +5,7 @@ LL | let y: u32 = x.abs() as u32;
|
||||
| ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()`
|
||||
|
|
||||
= note: `-D clippy::cast-abs-to-unsigned` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_abs_to_unsigned)]`
|
||||
|
||||
error: casting the result of `i32::abs()` to usize
|
||||
--> $DIR/cast_abs_to_unsigned.rs:10:20
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user