Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Peter Fürstenau 2018-12-28 20:19:51 +01:00
commit 6ee0e22204
265 changed files with 5100 additions and 5055 deletions

View file

@ -760,6 +760,7 @@ All notable changes to this project will be documented in this file.
[`mistyped_literal_suffixes`]: https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
[`mixed_case_hex_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_case_hex_literals
[`module_inception`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
[`module_name_repetitions`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
[`modulo_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#modulo_one
[`multiple_crate_versions`]: https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
[`multiple_inherent_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#multiple_inherent_impl
@ -850,7 +851,6 @@ All notable changes to this project will be documented in this file.
[`string_extend_chars`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_extend_chars
[`string_lit_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_lit_as_bytes
[`string_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_to_string
[`stutter`]: https://rust-lang.github.io/rust-clippy/master/index.html#stutter
[`suspicious_arithmetic_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_arithmetic_impl
[`suspicious_assignment_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_assignment_formatting
[`suspicious_else_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting

View file

@ -19,8 +19,8 @@ All contributors are expected to follow the [Rust Code of Conduct](http://www.ru
* [Running test suite](#running-test-suite)
* [Running rustfmt](#running-rustfmt)
* [Testing manually](#testing-manually)
* [How Clippy works](#how-clippy-works)
* [Fixing nightly build failures](#fixing-build-failures-caused-by-rust)
* [How Clippy works](#how-clippy-works)
* [Fixing nightly build failures](#fixing-build-failures-caused-by-rust)
* [Issue and PR Triage](#issue-and-pr-triage)
* [Bors and Homu](#bors-and-homu)
* [Contributions](#contributions)
@ -42,6 +42,13 @@ Some issues are easier than others. The [`good first issue`](https://github.com/
label can be used to find the easy issues. If you want to work on an issue, please leave a comment
so that we can assign it to you!
There are also some abandoned PRs, marked with
[`S-inactive-closed`](https://github.com/rust-lang/rust-clippy/pulls?q=is%3Aclosed+label%3AS-inactive-closed).
Pretty often these PRs are nearly completed and just need some extra steps
(formatting, addressing review comments, ...) to be merged. If you want to
complete such a PR, please leave a comment in the PR and open a new one based
on it.
Issues marked [`T-AST`](https://github.com/rust-lang/rust-clippy/labels/T-AST) involve simple
matching of the syntax tree structure, and are generally easier than
[`T-middle`](https://github.com/rust-lang/rust-clippy/labels/T-middle) issues, which involve types
@ -168,7 +175,7 @@ Manually testing against an example file is useful if you have added some
local modifications, run `env CLIPPY_TESTS=true cargo run --bin clippy-driver -- -L ./target/debug input.rs`
from the working copy root.
### How Clippy works
## How Clippy works
Clippy is a [rustc compiler plugin][compiler_plugin]. The main entry point is at [`src/lib.rs`][main_entry]. In there, the lint registration is delegated to the [`clippy_lints`][lint_crate] crate.
@ -218,7 +225,7 @@ The difference between `EarlyLintPass` and `LateLintPass` is that the methods of
That's why the `else_if_without_else` example uses the `register_early_lint_pass` function. Because the [actual lint logic][else_if_without_else] does not depend on any type information.
### Fixing build failures caused by Rust
## Fixing build failures caused by Rust
Clippy will sometimes fail to build from source because building it depends on unstable internal Rust features. Most of the times we have to adapt to the changes and only very rarely there's an actual bug in Rust. Fixing build failures caused by Rust updates, can be a good way to learn about Rust internals.

View file

@ -79,7 +79,7 @@ To have cargo compile your crate with Clippy without Clippy installation
in your code, you can use:
```terminal
cargo run --bin cargo-clippy --manifest-path=path_to_clippys_Cargo.toml
RUSTFLAGS=--sysroot=`rustc --print sysroot` cargo run --bin cargo-clippy --manifest-path=path_to_clippys_Cargo.toml
```
*[Note](https://github.com/rust-lang/rust-clippy/wiki#a-word-of-warning):*
@ -151,6 +151,10 @@ Note: `deny` produces errors instead of warnings.
If you do not want to include your lint levels in your code, you can globally enable/disable lints by passing extra flags to Clippy during the run: `cargo clippy -- -A clippy::lint_name` will run Clippy with `lint_name` disabled and `cargo clippy -- -W clippy::lint_name` will run it with that enabled. This also works with lint groups. For example you can run Clippy with warnings for all lints enabled: `cargo clippy -- -W clippy::pedantic`
## Contributing
If you want to contribute to Clippy, you can find more information in [CONTRIBUTING.md](https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md).
## License
Copyright 2014-2018 The Rust Project Developers

View file

@ -26,23 +26,38 @@ cd clippy_lints && cargo test && cd ..
cd rustc_tools_util && cargo test && cd ..
cd clippy_dev && cargo test && cd ..
# make sure clippy can be called via ./path/to/cargo-clippy
cd clippy_workspace_tests
../target/debug/cargo-clippy
cd ..
# Perform various checks for lint registration
./util/dev update_lints --check
cargo +nightly fmt --all -- --check
#avoid loop spam
set +x
# make sure tests are formatted
# some lints are sensitive to formatting, exclude some files
needs_formatting=false
tests_need_reformatting="false"
# switch to nightly
rustup default nightly
# avoid loop spam and allow cmds with exit status != 0
set +ex
for file in `find tests -not -path "tests/ui/methods.rs" -not -path "tests/ui/format.rs" -not -path "tests/ui/formatting.rs" -not -path "tests/ui/empty_line_after_outer_attribute.rs" -not -path "tests/ui/double_parens.rs" -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
rustfmt ${file} --check || echo "${file} needs reformatting!" ; needs_formatting=true
rustfmt ${file} --check
if [ $? -ne 0 ]; then
echo "${file} needs reformatting!"
tests_need_reformatting="true"
fi
done
if [ "${needs_reformatting}" = true ] ; then
set -ex # reset
if [ "${tests_need_reformatting}" == "true" ] ; then
echo "Tests need reformatting!"
exit 2
fi
set -x
# switch back to master
rustup default master

View file

@ -21,7 +21,7 @@ function check() {
# run clippy on a project, try to be verbose and trigger as many warnings as possible for greater coverage
RUST_BACKTRACE=full cargo clippy --all-targets --all-features -- --cap-lints warn -W clippy::pedantic -W clippy::nursery &> clippy_output
cat clippy_output
! cat clippy_output | grep -q "internal compiler error\|query stack during panic"
! cat clippy_output | grep -q "internal compiler error\|query stack during panic\|E0463"
if [[ $? != 0 ]]; then
return 1
fi

View file

@ -432,7 +432,7 @@ fn test_gen_deprecated() {
"should_assert_eq",
"group1",
"abc",
Some("has been superseeded by should_assert_eq2"),
Some("has been superseded by should_assert_eq2"),
"module_name",
),
Lint::new(
@ -447,7 +447,7 @@ fn test_gen_deprecated() {
let expected: Vec<String> = vec![
" store.register_removed(",
" \"should_assert_eq\",",
" \"has been superseeded by should_assert_eq2\",",
" \"has been superseded by should_assert_eq2\",",
" );",
" store.register_removed(",
" \"another_deprecated\",",

View file

@ -337,7 +337,9 @@ fn check_clippy_lint_names(cx: &LateContext<'_, '_>, items: &[NestedMetaItem]) {
&name_lower,
Some(tool_name.as_str())
) {
CheckLintNameResult::NoLint => (),
// FIXME: can we suggest similar lint names here?
// https://github.com/rust-lang/rust/pull/56992
CheckLintNameResult::NoLint(None) => (),
_ => {
db.span_suggestion(lint.span,
"lowercase the lint name",

View file

@ -17,7 +17,7 @@ use crate::syntax::source_map::Span;
use crate::utils::{snippet_with_applicability, span_lint_and_sugg, SpanlessEq};
/// **What it does:** Checks for double comparions that could be simpified to a single expression.
/// **What it does:** Checks for double comparions that could be simplified to a single expression.
///
///
/// **Why is this bad?** Readability.

View file

@ -75,7 +75,7 @@ declare_clippy_lint! {
/// }
/// ```
declare_clippy_lint! {
pub STUTTER,
pub MODULE_NAME_REPETITIONS,
pedantic,
"type names prefixed/postfixed with their containing module's name"
}
@ -126,7 +126,12 @@ impl EnumVariantNames {
impl LintPass for EnumVariantNames {
fn get_lints(&self) -> LintArray {
lint_array!(ENUM_VARIANT_NAMES, PUB_ENUM_VARIANT_NAMES, STUTTER, MODULE_INCEPTION)
lint_array!(
ENUM_VARIANT_NAMES,
PUB_ENUM_VARIANT_NAMES,
MODULE_NAME_REPETITIONS,
MODULE_INCEPTION
)
}
}
@ -277,7 +282,7 @@ impl EarlyLintPass for EnumVariantNames {
match item_camel.chars().nth(nchars) {
Some(c) if is_word_beginning(c) => span_lint(
cx,
STUTTER,
MODULE_NAME_REPETITIONS,
item.span,
"item name starts with its containing module's name",
),
@ -287,7 +292,7 @@ impl EarlyLintPass for EnumVariantNames {
if rmatching == nchars {
span_lint(
cx,
STUTTER,
MODULE_NAME_REPETITIONS,
item.span,
"item name ends with its containing module's name",
);

View file

@ -31,8 +31,8 @@ declare_clippy_lint! {
"suspicious formatting of `*=`, `-=` or `!=`"
}
/// **What it does:** Checks for formatting of `else if`. It lints if the `else`
/// and `if` are not on the same line or the `else` seems to be missing.
/// **What it does:** Checks for formatting of `else`. It lints if the `else`
/// is followed immediately by a newline or the `else` seems to be missing.
///
/// **Why is this bad?** This is probably some refactoring remnant, even if the
/// code is correct, it might look confusing.
@ -42,19 +42,29 @@ declare_clippy_lint! {
/// **Example:**
/// ```rust,ignore
/// if foo {
/// } { // looks like an `else` is missing here
/// }
///
/// if foo {
/// } if bar { // looks like an `else` is missing here
/// }
///
/// if foo {
/// } else
///
/// { // this is the `else` block of the previous `if`, but should it be?
/// }
///
/// if foo {
/// } else
///
/// if bar { // this is the `else` block of the previous `if`, but should it be?
/// }
/// ```
declare_clippy_lint! {
pub SUSPICIOUS_ELSE_FORMATTING,
style,
"suspicious formatting of `else if`"
"suspicious formatting of `else`"
}
/// **What it does:** Checks for possible missing comma in an array. It lints if
@ -96,7 +106,7 @@ impl EarlyLintPass for Formatting {
match (&w[0].node, &w[1].node) {
(&ast::StmtKind::Expr(ref first), &ast::StmtKind::Expr(ref second))
| (&ast::StmtKind::Expr(ref first), &ast::StmtKind::Semi(ref second)) => {
check_consecutive_ifs(cx, first, second);
check_missing_else(cx, first, second);
},
_ => (),
}
@ -105,7 +115,7 @@ impl EarlyLintPass for Formatting {
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
check_assign(cx, expr);
check_else_if(cx, expr);
check_else(cx, expr);
check_array(cx, expr);
}
}
@ -139,10 +149,18 @@ fn check_assign(cx: &EarlyContext<'_>, expr: &ast::Expr) {
}
}
/// Implementation of the `SUSPICIOUS_ELSE_FORMATTING` lint for weird `else if`.
fn check_else_if(cx: &EarlyContext<'_>, expr: &ast::Expr) {
/// Implementation of the `SUSPICIOUS_ELSE_FORMATTING` lint for weird `else`.
fn check_else(cx: &EarlyContext<'_>, expr: &ast::Expr) {
if let Some((then, &Some(ref else_))) = unsugar_if(expr) {
if unsugar_if(else_).is_some() && !differing_macro_contexts(then.span, else_.span) && !in_macro(then.span) {
if (is_block(else_) || unsugar_if(else_).is_some())
&& !differing_macro_contexts(then.span, else_.span)
&& !in_macro(then.span)
{
// workaround for rust-lang/rust#43081
if expr.span.lo().0 == 0 && expr.span.hi().0 == 0 {
return;
}
// this will be a span from the closing } of the “then” block (excluding) to
// the
// “if” of the “else if” block (excluding)
@ -154,14 +172,19 @@ fn check_else_if(cx: &EarlyContext<'_>, expr: &ast::Expr) {
let else_pos = else_snippet.find("else").expect("there must be a `else` here");
if else_snippet[else_pos..].contains('\n') {
let else_desc = if unsugar_if(else_).is_some() { "if" } else { "{..}" };
span_note_and_lint(
cx,
SUSPICIOUS_ELSE_FORMATTING,
else_span,
"this is an `else if` but the formatting might hide it",
&format!("this is an `else {}` but the formatting might hide it", else_desc),
else_span,
"to remove this lint, remove the `else` or remove the new line between `else` \
and `if`",
&format!(
"to remove this lint, remove the `else` or remove the new line between \
`else` and `{}`",
else_desc,
),
);
}
}
@ -200,32 +223,47 @@ fn check_array(cx: &EarlyContext<'_>, expr: &ast::Expr) {
}
}
/// Implementation of the `SUSPICIOUS_ELSE_FORMATTING` lint for consecutive ifs.
fn check_consecutive_ifs(cx: &EarlyContext<'_>, first: &ast::Expr, second: &ast::Expr) {
fn check_missing_else(cx: &EarlyContext<'_>, first: &ast::Expr, second: &ast::Expr) {
if !differing_macro_contexts(first.span, second.span)
&& !in_macro(first.span)
&& unsugar_if(first).is_some()
&& unsugar_if(second).is_some()
&& (is_block(second) || unsugar_if(second).is_some())
{
// where the else would be
let else_span = first.span.between(second.span);
if let Some(else_snippet) = snippet_opt(cx, else_span) {
if !else_snippet.contains('\n') {
let (looks_like, next_thing) = if unsugar_if(second).is_some() {
("an `else if`", "the second `if`")
} else {
("an `else {..}`", "the next block")
};
span_note_and_lint(
cx,
SUSPICIOUS_ELSE_FORMATTING,
else_span,
"this looks like an `else if` but the `else` is missing",
&format!("this looks like {} but the `else` is missing", looks_like),
else_span,
"to remove this lint, add the missing `else` or add a new line before the second \
`if`",
&format!(
"to remove this lint, add the missing `else` or add a new line before {}",
next_thing,
),
);
}
}
}
}
fn is_block(expr: &ast::Expr) -> bool {
if let ast::ExprKind::Block(..) = expr.node {
true
} else {
false
}
}
/// Match `if` or `if let` expressions and return the `then` and `else` block.
fn unsugar_if(expr: &ast::Expr) -> Option<(&P<ast::Block>, &Option<P<ast::Expr>>)> {
match expr.node {

View file

@ -12,7 +12,7 @@ use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use crate::rustc::{declare_tool_lint, lint_array};
use crate::rustc_errors::Applicability;
use crate::syntax::{ast::NodeId, source_map::Span};
use crate::utils::{snippet_opt, span_lint_and_then};
use crate::utils::{in_macro, snippet_opt, span_lint_and_then};
/// **What it does:** Checks for missing return statements at the end of a block.
///
@ -116,14 +116,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
_: FnKind<'tcx>,
_: &'tcx FnDecl,
body: &'tcx Body,
_: Span,
span: Span,
_: NodeId,
) {
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
let mir = cx.tcx.optimized_mir(def_id);
// checking return type through MIR, HIR is not able to determine inferred closure return types
if !mir.return_ty().is_unit() {
// make sure it's not a macro
if !mir.return_ty().is_unit() && !in_macro(span) {
Self::expr_match(cx, &body.value);
}
}

View file

@ -517,8 +517,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
doc::DOC_MARKDOWN,
empty_enum::EMPTY_ENUM,
enum_glob_use::ENUM_GLOB_USE,
enum_variants::MODULE_NAME_REPETITIONS,
enum_variants::PUB_ENUM_VARIANT_NAMES,
enum_variants::STUTTER,
if_not_else::IF_NOT_ELSE,
infinite_iter::MAYBE_INFINITE_ITER,
items_after_statements::ITEMS_AFTER_STATEMENTS,
@ -1030,6 +1030,10 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
]);
}
pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
}
// only exists to let the dogfood integration test works.
// Don't run clippy as an executable directly
#[allow(dead_code)]

View file

@ -478,6 +478,11 @@ impl LintPass for Pass {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
// we don't want to check expanded macros
if in_macro(expr.span) {
return;
}
if let Some((pat, arg, body)) = higher::for_loop(expr) {
check_for_loop(cx, pat, arg, body, expr);
}
@ -751,7 +756,8 @@ fn never_loop_expr(expr: &Expr, main_loop_id: NodeId) -> NeverLoopResult {
| ExprKind::Closure(_, _, _, _, _)
| ExprKind::InlineAsm(_, _, _)
| ExprKind::Path(_)
| ExprKind::Lit(_) => NeverLoopResult::Otherwise,
| ExprKind::Lit(_)
| ExprKind::Err => NeverLoopResult::Otherwise,
}
}

View file

@ -27,7 +27,9 @@ pub struct Pass;
///
/// **Why is this bad?** Readability, this can be written more concisely
///
/// **Known problems:** None.
/// **Known problems:** Sometimes `.cloned()` requires stricter trait
/// bound than `.map(|e| e.clone())` (which works because of the coercion).
/// See [#498](https://github.com/rust-lang-nursery/rust-clippy/issues/498).
///
/// **Example:**
///

View file

@ -199,7 +199,6 @@ fn suggestion_msg(function_type: &str, map_type: &str) -> String {
fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr, map_args: &[hir::Expr]) {
let var_arg = &map_args[0];
let fn_arg = &map_args[1];
let (map_type, variant, lint) = if match_type(cx, cx.tables.expr_ty(var_arg), &paths::OPTION) {
("Option", "Some", OPTION_MAP_UNIT_FN)
@ -208,6 +207,7 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr
} else {
return;
};
let fn_arg = &map_args[1];
if is_unit_function(cx, fn_arg) {
let msg = suggestion_msg("function", map_type);

View file

@ -22,7 +22,7 @@ use crate::utils::{match_type, paths, span_lint};
///
/// **Why is this bad?** Using a mutex just to make access to a plain bool or
/// reference sequential is shooting flies with cannons.
/// `std::atomic::AtomicBool` and `std::atomic::AtomicPtr` are leaner and
/// `std::sync::atomic::AtomicBool` and `std::sync::atomic::AtomicPtr` are leaner and
/// faster.
///
/// **Known problems:** This lint cannot detect if the mutex is actually used
@ -43,7 +43,7 @@ declare_clippy_lint! {
///
/// **Why is this bad?** Using a mutex just to make access to a plain integer
/// sequential is
/// shooting flies with cannons. `std::atomic::usize` is leaner and faster.
/// shooting flies with cannons. `std::sync::atomic::AtomicUsize` is leaner and faster.
///
/// **Known problems:** This lint cannot detect if the mutex is actually used
/// for waiting before a critical section.

View file

@ -504,6 +504,9 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
self.current = value_pat;
self.visit_expr(value);
},
ExprKind::Err => {
println!("Err = {}", current);
},
}
}

View file

@ -615,6 +615,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
self.hash_name(l.ident.name);
}
},
ExprKind::Err => {},
}
}

View file

@ -347,6 +347,9 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
println!("{}repeat count:", ind);
print_expr(cx, &cx.tcx.hir().body(anon_const.body).value, indent + 1);
},
hir::ExprKind::Err => {
println!("{}Err", ind);
},
}
}

View file

@ -79,7 +79,8 @@ impl<'a> Sugg<'a> {
| hir::ExprKind::Ret(..)
| hir::ExprKind::Struct(..)
| hir::ExprKind::Tup(..)
| hir::ExprKind::While(..) => Sugg::NonParen(snippet),
| hir::ExprKind::While(..)
| hir::ExprKind::Err => Sugg::NonParen(snippet),
hir::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
hir::ExprKind::AssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),
hir::ExprKind::Binary(op, ..) => Sugg::BinOp(AssocOp::from_ast_binop(higher::binop(op.node)), snippet),
@ -158,7 +159,8 @@ impl<'a> Sugg<'a> {
| ast::ExprKind::Tup(..)
| ast::ExprKind::Array(..)
| ast::ExprKind::While(..)
| ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet),
| ast::ExprKind::WhileLet(..)
| ast::ExprKind::Err => Sugg::NonParen(snippet),
ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet),
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotEq, snippet),
ast::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),

View file

@ -257,7 +257,7 @@ impl EarlyLintPass for Pass {
}
/// Checks the arguments of `print[ln]!` and `write[ln]!` calls. It will return a tuple of two
/// options. The first part of the tuple is `format_str` of the macros. The secund part of the tuple
/// options. The first part of the tuple is `format_str` of the macros. The second part of the tuple
/// is in the `write[ln]!` case the expression the `format_str` should be written to.
///
/// Example:
@ -292,7 +292,7 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) -
};
let tmp = fmtstr.clone();
let mut args = vec![];
let mut fmt_parser = Parser::new(&tmp, None);
let mut fmt_parser = Parser::new(&tmp, None, Vec::new(), false);
while let Some(piece) = fmt_parser.next() {
if !fmt_parser.errors.is_empty() {
return (None, expr);

View file

@ -2,5 +2,11 @@
name = "rustc_tools_util"
version = "0.1.0"
authors = ["Matthias Krüger <matthias.krueger@famsik.de>"]
description = "small helper to generate version information for git packages"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
license = "MIT/Apache-2.0"
keywords = ["rustc", "tool", "git", "version", "hash"]
categories = ["development-tools"]
edition = "2018"
[dependencies]

View file

@ -0,0 +1,58 @@
# rustc_tools_util
A small tool to help you generate version information
for packages installed from a git repo
## Usage
Add a `build.rs` file to your repo and list it in `Cargo.toml`
````
build = "build.rs"
````
List rustc_tools_util as regular AND build dependency.
````
[dependencies]
rustc_tools_util = "0.1"
[build-dependencies]
rustc_tools_util = "0.1"
````
In `build.rs`, generate the data in your `main()`
````rust
fn main() {
println!(
"cargo:rustc-env=GIT_HASH={}",
rustc_tools_util::get_commit_hash().unwrap_or_default()
);
println!(
"cargo:rustc-env=COMMIT_DATE={}",
rustc_tools_util::get_commit_date().unwrap_or_default()
);
}
````
Use the version information in your main.rs
````rust
use rustc_tools_util::*;
fn show_version() {
let version_info = rustc_tools_util::get_version_info!();
println!("{}", version_info);
}
````
This gives the following output in clippy:
`clippy 0.0.212 (a416c5e 2018-12-14)`
## License
Copyright 2014-2018 The Rust Project Developers
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
<LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
option. All files in the project carrying such notice may not be
copied, modified, or distributed except according to those terms.

View file

@ -23,7 +23,7 @@ use self::rustc_driver::{driver::CompileController, Compilation};
use std::convert::TryInto;
use std::path::Path;
use std::process::exit;
use std::process::{exit, Command};
fn show_version() {
println!(env!("CARGO_PKG_VERSION"));
@ -40,22 +40,54 @@ pub fn main() {
exit(0);
}
let sys_root = option_env!("SYSROOT")
.map(String::from)
.or_else(|| std::env::var("SYSROOT").ok())
.or_else(|| {
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN"));
home.and_then(|home| toolchain.map(|toolchain| format!("{}/toolchains/{}", home, toolchain)))
})
.or_else(|| {
Command::new("rustc")
.arg("--print")
.arg("sysroot")
.output()
.ok()
.and_then(|out| String::from_utf8(out.stdout).ok())
.map(|s| s.trim().to_owned())
})
.expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust");
// Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument.
// We're invoking the compiler programmatically, so we ignore this/
let mut args: Vec<String> = env::args().collect();
if args.len() <= 1 {
let mut orig_args: Vec<String> = env::args().collect();
if orig_args.len() <= 1 {
std::process::exit(1);
}
if Path::new(&args[1]).file_stem() == Some("rustc".as_ref()) {
if Path::new(&orig_args[1]).file_stem() == Some("rustc".as_ref()) {
// we still want to be able to invoke it normally though
args.remove(1);
orig_args.remove(1);
}
// this conditional check for the --sysroot flag is there so users can call
// `clippy_driver` directly
// without having to pass --sysroot or anything
let mut args: Vec<String> = if orig_args.iter().any(|s| s == "--sysroot") {
orig_args.clone()
} else {
orig_args
.clone()
.into_iter()
.chain(Some("--sysroot".to_owned()))
.chain(Some(sys_root))
.collect()
};
// this check ensures that dependencies are built but not linted and the final
// crate is
// linted but not built
let clippy_enabled = env::var("CLIPPY_TESTS").ok().map_or(false, |val| val == "true")
|| args.iter().any(|s| s == "--emit=dep-info,metadata");
|| orig_args.iter().any(|s| s == "--emit=dep-info,metadata");
if clippy_enabled {
args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]);
@ -110,6 +142,7 @@ pub fn main() {
ls.register_group(Some(sess), true, name, deprecated_name, to);
}
clippy_lints::register_pre_expansion_lints(sess, &mut ls, &conf);
clippy_lints::register_renamed(&mut ls);
sess.plugin_llvm_passes.borrow_mut().extend(llvm_passes);
sess.plugin_attributes.borrow_mut().extend(attributes);

View file

@ -16,6 +16,8 @@
// FIXME: switch to something more ergonomic here, once available.
// (currently there is no way to opt into sysroot crates w/o `extern crate`)
#[allow(unused_extern_crates)]
extern crate rustc_driver;
#[allow(unused_extern_crates)]
extern crate rustc_plugin;
use self::rustc_plugin::Registry;

View file

@ -33,10 +33,9 @@ with:
-D --deny OPT Set lint denied
-F --forbid OPT Set lint forbidden
The feature `cargo-clippy` is automatically defined for convenience. You can use
it to allow or deny lints from the code, eg.:
You can use tool lints to allow or deny lints from your code, eg.:
#[cfg_attr(feature = "cargo-clippy", allow(needless_lifetimes))]
#[allow(clippy::needless_lifetimes)]
"#;
fn show_help() {

View file

@ -17,7 +17,6 @@ use std::ffi::OsStr;
use std::fs;
use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;
fn clippy_driver_path() -> PathBuf {
if let Some(path) = option_env!("CLIPPY_DRIVER_PATH") {
@ -43,28 +42,6 @@ fn rustc_lib_path() -> PathBuf {
option_env!("RUSTC_LIB_PATH").unwrap().into()
}
fn rustc_sysroot_path() -> PathBuf {
option_env!("SYSROOT")
.map(String::from)
.or_else(|| std::env::var("SYSROOT").ok())
.or_else(|| {
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN"));
home.and_then(|home| toolchain.map(|toolchain| format!("{}/toolchains/{}", home, toolchain)))
})
.or_else(|| {
Command::new("rustc")
.arg("--print")
.arg("sysroot")
.output()
.ok()
.and_then(|out| String::from_utf8(out.stdout).ok())
.map(|s| s.trim().to_owned())
})
.expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust")
.into()
}
fn config(mode: &str, dir: PathBuf) -> compiletest::Config {
let mut config = compiletest::Config::default();
@ -79,9 +56,8 @@ fn config(mode: &str, dir: PathBuf) -> compiletest::Config {
config.compile_lib_path = rustc_lib_path();
}
config.target_rustcflags = Some(format!(
"-L {0} -L {0}/deps -Dwarnings --sysroot {1}",
host_libs().display(),
rustc_sysroot_path().display()
"-L {0} -L {0}/deps -Dwarnings -Zui-testing",
host_libs().display()
));
config.mode = cfg_mode;

View file

@ -7,31 +7,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::path::PathBuf;
use std::process::Command;
fn rustc_sysroot_path() -> PathBuf {
option_env!("SYSROOT")
.map(String::from)
.or_else(|| std::env::var("SYSROOT").ok())
.or_else(|| {
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN"));
home.and_then(|home| toolchain.map(|toolchain| format!("{}/toolchains/{}", home, toolchain)))
})
.or_else(|| {
Command::new("rustc")
.arg("--print")
.arg("sysroot")
.output()
.ok()
.and_then(|out| String::from_utf8(out.stdout).ok())
.map(|s| s.trim().to_owned())
})
.expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust")
.into()
}
#[test]
fn dogfood() {
if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
@ -46,7 +21,6 @@ fn dogfood() {
let output = std::process::Command::new(clippy_cmd)
.current_dir(root_dir)
.env("CLIPPY_DOGFOOD", "1")
.env("RUSTFLAGS", format!("--sysroot {}", rustc_sysroot_path().display()))
.arg("clippy")
.arg("--all-targets")
.arg("--all-features")
@ -85,7 +59,6 @@ fn dogfood_tests() {
let output = std::process::Command::new(&clippy_cmd)
.current_dir(root_dir.join(d))
.env("CLIPPY_DOGFOOD", "1")
.env("RUSTFLAGS", format!("--sysroot {}", rustc_sysroot_path().display()))
.arg("clippy")
.arg("--")
.args(&["-D", "clippy::all"])

View file

@ -1,7 +1,7 @@
error: use of a blacklisted/placeholder name `toto`
--> $DIR/conf_french_blacklisted_name.rs:15:9
|
15 | fn test(toto: ()) {}
LL | fn test(toto: ()) {}
| ^^^^
|
= note: `-D clippy::blacklisted-name` implied by `-D warnings`
@ -9,37 +9,37 @@ error: use of a blacklisted/placeholder name `toto`
error: use of a blacklisted/placeholder name `toto`
--> $DIR/conf_french_blacklisted_name.rs:18:9
|
18 | let toto = 42;
LL | let toto = 42;
| ^^^^
error: use of a blacklisted/placeholder name `tata`
--> $DIR/conf_french_blacklisted_name.rs:19:9
|
19 | let tata = 42;
LL | let tata = 42;
| ^^^^
error: use of a blacklisted/placeholder name `titi`
--> $DIR/conf_french_blacklisted_name.rs:20:9
|
20 | let titi = 42;
LL | let titi = 42;
| ^^^^
error: use of a blacklisted/placeholder name `toto`
--> $DIR/conf_french_blacklisted_name.rs:26:10
|
26 | (toto, Some(tata), titi @ Some(_)) => (),
LL | (toto, Some(tata), titi @ Some(_)) => (),
| ^^^^
error: use of a blacklisted/placeholder name `tata`
--> $DIR/conf_french_blacklisted_name.rs:26:21
|
26 | (toto, Some(tata), titi @ Some(_)) => (),
LL | (toto, Some(tata), titi @ Some(_)) => (),
| ^^^^
error: use of a blacklisted/placeholder name `titi`
--> $DIR/conf_french_blacklisted_name.rs:26:28
|
26 | (toto, Some(tata), titi @ Some(_)) => (),
LL | (toto, Some(tata), titi @ Some(_)) => (),
| ^^^^
error: aborting due to 7 previous errors

View file

@ -1,7 +1,7 @@
error: this argument is passed by reference, but would be more efficient if passed by value
--> $DIR/test.rs:20:11
|
20 | fn bad(x: &u16, y: &Foo) {}
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`
@ -9,7 +9,7 @@ error: this argument is passed by reference, but would be more efficient if pass
error: this argument is passed by reference, but would be more efficient if passed by value
--> $DIR/test.rs:20:20
|
20 | fn bad(x: &u16, y: &Foo) {}
LL | fn bad(x: &u16, y: &Foo) {}
| ^^^^ help: consider passing by value instead: `Foo`
error: aborting due to 2 previous errors

View file

@ -1,7 +1,7 @@
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:23:5
|
23 | u <= 0;
LL | u <= 0;
| ^^^^^^
|
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
@ -10,7 +10,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:24:5
|
24 | u <= Z;
LL | u <= Z;
| ^^^^^^
|
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == Z instead
@ -18,7 +18,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:25:5
|
25 | u < Z;
LL | u < Z;
| ^^^^^
|
= help: because Z is the minimum value for this type, this comparison is always false
@ -26,7 +26,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:26:5
|
26 | Z >= u;
LL | Z >= u;
| ^^^^^^
|
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using Z == u instead
@ -34,7 +34,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:27:5
|
27 | Z > u;
LL | Z > u;
| ^^^^^
|
= help: because Z is the minimum value for this type, this comparison is always false
@ -42,7 +42,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:28:5
|
28 | u > std::u32::MAX;
LL | u > std::u32::MAX;
| ^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
@ -50,7 +50,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:29:5
|
29 | u >= std::u32::MAX;
LL | u >= std::u32::MAX;
| ^^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == std::u32::MAX instead
@ -58,7 +58,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:30:5
|
30 | std::u32::MAX < u;
LL | std::u32::MAX < u;
| ^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
@ -66,7 +66,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:31:5
|
31 | std::u32::MAX <= u;
LL | std::u32::MAX <= u;
| ^^^^^^^^^^^^^^^^^^
|
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using std::u32::MAX == u instead
@ -74,7 +74,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:32:5
|
32 | 1-1 > u;
LL | 1-1 > u;
| ^^^^^^^
|
= help: because 1-1 is the minimum value for this type, this comparison is always false
@ -82,7 +82,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:33:5
|
33 | u >= !0;
LL | u >= !0;
| ^^^^^^^
|
= help: because !0 is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == !0 instead
@ -90,7 +90,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:34:5
|
34 | u <= 12 - 2*6;
LL | u <= 12 - 2*6;
| ^^^^^^^^^^^^^
|
= help: because 12 - 2*6 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 12 - 2*6 instead
@ -98,7 +98,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:36:5
|
36 | i < -127 - 1;
LL | i < -127 - 1;
| ^^^^^^^^^^^^
|
= help: because -127 - 1 is the minimum value for this type, this comparison is always false
@ -106,7 +106,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:37:5
|
37 | std::i8::MAX >= i;
LL | std::i8::MAX >= i;
| ^^^^^^^^^^^^^^^^^
|
= help: because std::i8::MAX is the maximum value for this type, this comparison is always true
@ -114,7 +114,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:38:5
|
38 | 3-7 < std::i32::MIN;
LL | 3-7 < std::i32::MIN;
| ^^^^^^^^^^^^^^^^^^^
|
= help: because std::i32::MIN is the minimum value for this type, this comparison is always false
@ -122,7 +122,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:40:5
|
40 | b >= true;
LL | b >= true;
| ^^^^^^^^^
|
= help: because true is the maximum value for this type, the case where the two sides are not equal never occurs, consider using b == true instead
@ -130,7 +130,7 @@ error: this comparison involving the minimum or maximum element for this type co
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:41:5
|
41 | false > b;
LL | false > b;
| ^^^^^^^^^
|
= help: because false is the minimum value for this type, this comparison is always false
@ -138,7 +138,7 @@ error: this comparison involving the minimum or maximum element for this type co
error: <-comparison of unit values detected. This will always be false
--> $DIR/absurd-extreme-comparisons.rs:44:5
|
44 | () < {};
LL | () < {};
| ^^^^^^^
|
= note: #[deny(clippy::unit_cmp)] on by default

View file

@ -1,7 +1,7 @@
error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly
--> $DIR/approx_const.rs:13:16
|
13 | let my_e = 2.7182;
LL | let my_e = 2.7182;
| ^^^^^^
|
= note: `-D clippy::approx-constant` implied by `-D warnings`
@ -9,109 +9,109 @@ error: approximate value of `f{32, 64}::consts::E` found. Consider using it dire
error: approximate value of `f{32, 64}::consts::E` found. Consider using it directly
--> $DIR/approx_const.rs:14:20
|
14 | let almost_e = 2.718;
LL | let almost_e = 2.718;
| ^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_1_PI` found. Consider using it directly
--> $DIR/approx_const.rs:17:24
|
17 | let my_1_frac_pi = 0.3183;
LL | let my_1_frac_pi = 0.3183;
| ^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly
--> $DIR/approx_const.rs:20:28
|
20 | let my_frac_1_sqrt_2 = 0.70710678;
LL | let my_frac_1_sqrt_2 = 0.70710678;
| ^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_1_SQRT_2` found. Consider using it directly
--> $DIR/approx_const.rs:21:32
|
21 | let almost_frac_1_sqrt_2 = 0.70711;
LL | let almost_frac_1_sqrt_2 = 0.70711;
| ^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_2_PI` found. Consider using it directly
--> $DIR/approx_const.rs:24:24
|
24 | let my_frac_2_pi = 0.63661977;
LL | let my_frac_2_pi = 0.63661977;
| ^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_2_SQRT_PI` found. Consider using it directly
--> $DIR/approx_const.rs:27:27
|
27 | let my_frac_2_sq_pi = 1.128379;
LL | let my_frac_2_sq_pi = 1.128379;
| ^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_2` found. Consider using it directly
--> $DIR/approx_const.rs:30:24
|
30 | let my_frac_pi_2 = 1.57079632679;
LL | let my_frac_pi_2 = 1.57079632679;
| ^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_3` found. Consider using it directly
--> $DIR/approx_const.rs:33:24
|
33 | let my_frac_pi_3 = 1.04719755119;
LL | let my_frac_pi_3 = 1.04719755119;
| ^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_4` found. Consider using it directly
--> $DIR/approx_const.rs:36:24
|
36 | let my_frac_pi_4 = 0.785398163397;
LL | let my_frac_pi_4 = 0.785398163397;
| ^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_6` found. Consider using it directly
--> $DIR/approx_const.rs:39:24
|
39 | let my_frac_pi_6 = 0.523598775598;
LL | let my_frac_pi_6 = 0.523598775598;
| ^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::FRAC_PI_8` found. Consider using it directly
--> $DIR/approx_const.rs:42:24
|
42 | let my_frac_pi_8 = 0.3926990816987;
LL | let my_frac_pi_8 = 0.3926990816987;
| ^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LN_10` found. Consider using it directly
--> $DIR/approx_const.rs:45:20
|
45 | let my_ln_10 = 2.302585092994046;
LL | let my_ln_10 = 2.302585092994046;
| ^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LN_2` found. Consider using it directly
--> $DIR/approx_const.rs:48:19
|
48 | let my_ln_2 = 0.6931471805599453;
LL | let my_ln_2 = 0.6931471805599453;
| ^^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LOG10_E` found. Consider using it directly
--> $DIR/approx_const.rs:51:22
|
51 | let my_log10_e = 0.4342944819032518;
LL | let my_log10_e = 0.4342944819032518;
| ^^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::LOG2_E` found. Consider using it directly
--> $DIR/approx_const.rs:54:21
|
54 | let my_log2_e = 1.4426950408889634;
LL | let my_log2_e = 1.4426950408889634;
| ^^^^^^^^^^^^^^^^^^
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
--> $DIR/approx_const.rs:57:17
|
57 | let my_pi = 3.1415;
LL | let my_pi = 3.1415;
| ^^^^^^
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
--> $DIR/approx_const.rs:58:21
|
58 | let almost_pi = 3.14;
LL | let almost_pi = 3.14;
| ^^^^
error: approximate value of `f{32, 64}::consts::SQRT_2` found. Consider using it directly
--> $DIR/approx_const.rs:61:18
|
61 | let my_sq2 = 1.4142;
LL | let my_sq2 = 1.4142;
| ^^^^^^
error: aborting due to 19 previous errors

View file

@ -1,7 +1,7 @@
error: integer arithmetic detected
--> $DIR/arithmetic.rs:22:5
|
22 | 1 + i;
LL | 1 + i;
| ^^^^^
|
= note: `-D clippy::integer-arithmetic` implied by `-D warnings`
@ -9,32 +9,32 @@ error: integer arithmetic detected
error: integer arithmetic detected
--> $DIR/arithmetic.rs:23:5
|
23 | i * 2;
LL | i * 2;
| ^^^^^
error: integer arithmetic detected
--> $DIR/arithmetic.rs:24:5
|
24 | / 1 %
25 | | i / 2; // no error, this is part of the expression in the preceding line
LL | / 1 %
LL | | i / 2; // no error, this is part of the expression in the preceding line
| |_________^
error: integer arithmetic detected
--> $DIR/arithmetic.rs:26:5
|
26 | i - 2 + 2 - i;
LL | i - 2 + 2 - i;
| ^^^^^^^^^^^^^
error: integer arithmetic detected
--> $DIR/arithmetic.rs:27:5
|
27 | -i;
LL | -i;
| ^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:37:5
|
37 | f * 2.0;
LL | f * 2.0;
| ^^^^^^^
|
= note: `-D clippy::float-arithmetic` implied by `-D warnings`
@ -42,31 +42,31 @@ error: floating-point arithmetic detected
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:39:5
|
39 | 1.0 + f;
LL | 1.0 + f;
| ^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:40:5
|
40 | f * 2.0;
LL | f * 2.0;
| ^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:41:5
|
41 | f / 2.0;
LL | f / 2.0;
| ^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:42:5
|
42 | f - 2.0 * 4.2;
LL | f - 2.0 * 4.2;
| ^^^^^^^^^^^^^
error: floating-point arithmetic detected
--> $DIR/arithmetic.rs:43:5
|
43 | -f;
LL | -f;
| ^^
error: aborting due to 11 previous errors

View file

@ -1,7 +1,7 @@
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:14:5
|
14 | a = a + 1;
LL | a = a + 1;
| ^^^^^^^^^ help: replace it with: `a += 1`
|
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
@ -9,49 +9,49 @@ error: manual implementation of an assign operation
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:15:5
|
15 | a = 1 + a;
LL | a = 1 + a;
| ^^^^^^^^^ help: replace it with: `a += 1`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:16:5
|
16 | a = a - 1;
LL | a = a - 1;
| ^^^^^^^^^ help: replace it with: `a -= 1`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:17:5
|
17 | a = a * 99;
LL | a = a * 99;
| ^^^^^^^^^^ help: replace it with: `a *= 99`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:18:5
|
18 | a = 42 * a;
LL | a = 42 * a;
| ^^^^^^^^^^ help: replace it with: `a *= 42`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:19:5
|
19 | a = a / 2;
LL | a = a / 2;
| ^^^^^^^^^ help: replace it with: `a /= 2`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:20:5
|
20 | a = a % 5;
LL | a = a % 5;
| ^^^^^^^^^ help: replace it with: `a %= 5`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:21:5
|
21 | a = a & 1;
LL | a = a & 1;
| ^^^^^^^^^ help: replace it with: `a &= 1`
error: manual implementation of an assign operation
--> $DIR/assign_ops.rs:27:5
|
27 | s = s + "bla";
LL | s = s + "bla";
| ^^^^^^^^^^^^^ help: replace it with: `s += "bla"`
error: aborting due to 9 previous errors

View file

@ -1,135 +1,135 @@
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:14:5
|
14 | a += a + 1;
LL | a += a + 1;
| ^^^^^^^^^^
|
= note: `-D clippy::misrefactored-assign-op` implied by `-D warnings`
help: Did you mean a = a + 1 or a = a + a + 1? Consider replacing it with
|
14 | a += 1;
LL | a += 1;
| ^^^^^^
help: or
|
14 | a = a + a + 1;
LL | a = a + a + 1;
| ^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:15:5
|
15 | a += 1 + a;
LL | a += 1 + a;
| ^^^^^^^^^^
help: Did you mean a = a + 1 or a = a + 1 + a? Consider replacing it with
|
15 | a += 1;
LL | a += 1;
| ^^^^^^
help: or
|
15 | a = a + 1 + a;
LL | a = a + 1 + a;
| ^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:16:5
|
16 | a -= a - 1;
LL | a -= a - 1;
| ^^^^^^^^^^
help: Did you mean a = a - 1 or a = a - (a - 1)? Consider replacing it with
|
16 | a -= 1;
LL | a -= 1;
| ^^^^^^
help: or
|
16 | a = a - (a - 1);
LL | a = a - (a - 1);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:17:5
|
17 | a *= a * 99;
LL | a *= a * 99;
| ^^^^^^^^^^^
help: Did you mean a = a * 99 or a = a * a * 99? Consider replacing it with
|
17 | a *= 99;
LL | a *= 99;
| ^^^^^^^
help: or
|
17 | a = a * a * 99;
LL | a = a * a * 99;
| ^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:18:5
|
18 | a *= 42 * a;
LL | a *= 42 * a;
| ^^^^^^^^^^^
help: Did you mean a = a * 42 or a = a * 42 * a? Consider replacing it with
|
18 | a *= 42;
LL | a *= 42;
| ^^^^^^^
help: or
|
18 | a = a * 42 * a;
LL | a = a * 42 * a;
| ^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:19:5
|
19 | a /= a / 2;
LL | a /= a / 2;
| ^^^^^^^^^^
help: Did you mean a = a / 2 or a = a / (a / 2)? Consider replacing it with
|
19 | a /= 2;
LL | a /= 2;
| ^^^^^^
help: or
|
19 | a = a / (a / 2);
LL | a = a / (a / 2);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:20:5
|
20 | a %= a % 5;
LL | a %= a % 5;
| ^^^^^^^^^^
help: Did you mean a = a % 5 or a = a % (a % 5)? Consider replacing it with
|
20 | a %= 5;
LL | a %= 5;
| ^^^^^^
help: or
|
20 | a = a % (a % 5);
LL | a = a % (a % 5);
| ^^^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:21:5
|
21 | a &= a & 1;
LL | a &= a & 1;
| ^^^^^^^^^^
help: Did you mean a = a & 1 or a = a & a & 1? Consider replacing it with
|
21 | a &= 1;
LL | a &= 1;
| ^^^^^^
help: or
|
21 | a = a & a & 1;
LL | a = a & a & 1;
| ^^^^^^^^^^^^^
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:22:5
|
22 | a *= a * a;
LL | a *= a * a;
| ^^^^^^^^^^
help: Did you mean a = a * a or a = a * a * a? Consider replacing it with
|
22 | a *= a;
LL | a *= a;
| ^^^^^^
help: or
|
22 | a = a * a * a;
LL | a = a * a * a;
| ^^^^^^^^^^^^^
error: manual implementation of an assign operation
--> $DIR/assign_ops2.rs:59:5
|
59 | buf = buf + cows.clone();
LL | buf = buf + cows.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`
|
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`

View file

@ -1,7 +1,7 @@
error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea
--> $DIR/attrs.rs:12:1
|
12 | #[inline(always)]
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::inline-always` implied by `-D warnings`
@ -9,7 +9,7 @@ error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usuall
error: the since field must contain a semver-compliant version
--> $DIR/attrs.rs:32:14
|
32 | #[deprecated(since = "forever")]
LL | #[deprecated(since = "forever")]
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::deprecated-semver` implied by `-D warnings`
@ -17,7 +17,7 @@ error: the since field must contain a semver-compliant version
error: the since field must contain a semver-compliant version
--> $DIR/attrs.rs:35:14
|
35 | #[deprecated(since = "1")]
LL | #[deprecated(since = "1")]
| ^^^^^^^^^^^
error: aborting due to 3 previous errors

View file

@ -1,14 +1,14 @@
error: returning the result of a let binding from a block. Consider returning the expression directly.
--> $DIR/matches.rs:18:13
|
18 | x
LL | x
| ^
|
= note: `-D clippy::let-and-return` implied by `-D warnings`
note: this expression can be directly returned
--> $DIR/matches.rs:17:21
|
17 | let x = 3;
LL | let x = 3;
| ^
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
error: &-masking with zero
--> $DIR/bit_masks.rs:23:5
|
23 | x & 0 == 0;
LL | x & 0 == 0;
| ^^^^^^^^^^
|
= note: `-D clippy::bad-bit-mask` implied by `-D warnings`
@ -9,7 +9,7 @@ error: &-masking with zero
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/bit_masks.rs:23:5
|
23 | x & 0 == 0;
LL | x & 0 == 0;
| ^^^^^
|
= note: #[deny(clippy::erasing_op)] on by default
@ -17,73 +17,73 @@ error: this operation will always return zero. This is likely not the intended o
error: incompatible bit mask: `_ & 2` can never be equal to `1`
--> $DIR/bit_masks.rs:26:5
|
26 | x & 2 == 1;
LL | x & 2 == 1;
| ^^^^^^^^^^
error: incompatible bit mask: `_ | 3` can never be equal to `2`
--> $DIR/bit_masks.rs:30:5
|
30 | x | 3 == 2;
LL | x | 3 == 2;
| ^^^^^^^^^^
error: incompatible bit mask: `_ & 1` will never be higher than `1`
--> $DIR/bit_masks.rs:32:5
|
32 | x & 1 > 1;
LL | x & 1 > 1;
| ^^^^^^^^^
error: incompatible bit mask: `_ | 2` will always be higher than `1`
--> $DIR/bit_masks.rs:36:5
|
36 | x | 2 > 1;
LL | x | 2 > 1;
| ^^^^^^^^^
error: incompatible bit mask: `_ & 7` can never be equal to `8`
--> $DIR/bit_masks.rs:43:5
|
43 | x & THREE_BITS == 8;
LL | x & THREE_BITS == 8;
| ^^^^^^^^^^^^^^^^^^^
error: incompatible bit mask: `_ | 7` will never be lower than `7`
--> $DIR/bit_masks.rs:44:5
|
44 | x | EVEN_MORE_REDIRECTION < 7;
LL | x | EVEN_MORE_REDIRECTION < 7;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: &-masking with zero
--> $DIR/bit_masks.rs:46:5
|
46 | 0 & x == 0;
LL | 0 & x == 0;
| ^^^^^^^^^^
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/bit_masks.rs:46:5
|
46 | 0 & x == 0;
LL | 0 & x == 0;
| ^^^^^
error: incompatible bit mask: `_ | 2` will always be higher than `1`
--> $DIR/bit_masks.rs:50:5
|
50 | 1 < 2 | x;
LL | 1 < 2 | x;
| ^^^^^^^^^
error: incompatible bit mask: `_ | 3` can never be equal to `2`
--> $DIR/bit_masks.rs:51:5
|
51 | 2 == 3 | x;
LL | 2 == 3 | x;
| ^^^^^^^^^^
error: incompatible bit mask: `_ & 2` can never be equal to `1`
--> $DIR/bit_masks.rs:52:5
|
52 | 1 == x & 2;
LL | 1 == x & 2;
| ^^^^^^^^^^
error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly
--> $DIR/bit_masks.rs:63:5
|
63 | x | 1 > 3;
LL | x | 1 > 3;
| ^^^^^^^^^
|
= note: `-D clippy::ineffective-bit-mask` implied by `-D warnings`
@ -91,19 +91,19 @@ error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared
error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly
--> $DIR/bit_masks.rs:64:5
|
64 | x | 1 < 4;
LL | x | 1 < 4;
| ^^^^^^^^^
error: ineffective bit mask: `x | 1` compared to `3`, is the same as x compared directly
--> $DIR/bit_masks.rs:65:5
|
65 | x | 1 <= 3;
LL | x | 1 <= 3;
| ^^^^^^^^^^
error: ineffective bit mask: `x | 1` compared to `8`, is the same as x compared directly
--> $DIR/bit_masks.rs:66:5
|
66 | x | 1 >= 8;
LL | x | 1 >= 8;
| ^^^^^^^^^^
error: aborting due to 17 previous errors

View file

@ -1,7 +1,7 @@
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:20:9
|
20 | fn test(foo: ()) {}
LL | fn test(foo: ()) {}
| ^^^
|
= note: `-D clippy::blacklisted-name` implied by `-D warnings`
@ -9,79 +9,79 @@ error: use of a blacklisted/placeholder name `foo`
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:23:9
|
23 | let foo = 42;
LL | let foo = 42;
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:24:9
|
24 | let bar = 42;
LL | let bar = 42;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:25:9
|
25 | let baz = 42;
LL | let baz = 42;
| ^^^
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:31:10
|
31 | (foo, Some(bar), baz @ Some(_)) => (),
LL | (foo, Some(bar), baz @ Some(_)) => (),
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:31:20
|
31 | (foo, Some(bar), baz @ Some(_)) => (),
LL | (foo, Some(bar), baz @ Some(_)) => (),
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:31:26
|
31 | (foo, Some(bar), baz @ Some(_)) => (),
LL | (foo, Some(bar), baz @ Some(_)) => (),
| ^^^
error: use of a blacklisted/placeholder name `foo`
--> $DIR/blacklisted_name.rs:36:19
|
36 | fn issue_1647(mut foo: u8) {
LL | fn issue_1647(mut foo: u8) {
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:37:13
|
37 | let mut bar = 0;
LL | let mut bar = 0;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:38:21
|
38 | if let Some(mut baz) = Some(42) {}
LL | if let Some(mut baz) = Some(42) {}
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:42:13
|
42 | let ref bar = 0;
LL | let ref bar = 0;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:43:21
|
43 | if let Some(ref baz) = Some(42) {}
LL | if let Some(ref baz) = Some(42) {}
| ^^^
error: use of a blacklisted/placeholder name `bar`
--> $DIR/blacklisted_name.rs:47:17
|
47 | let ref mut bar = 0;
LL | let ref mut bar = 0;
| ^^^
error: use of a blacklisted/placeholder name `baz`
--> $DIR/blacklisted_name.rs:48:25
|
48 | if let Some(ref mut baz) = Some(42) {}
LL | if let Some(ref mut baz) = Some(42) {}
| ^^^
error: aborting due to 14 previous errors

View file

@ -1,11 +1,11 @@
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/block_in_if_condition.rs:35:8
|
35 | if {
LL | if {
| ________^
36 | | let x = 3;
37 | | x == 3
38 | | } {
LL | | let x = 3;
LL | | x == 3
LL | | } {
| |_____^
|
= note: `-D clippy::block-in-if-condition-stmt` implied by `-D warnings`
@ -21,7 +21,7 @@ error: in an 'if' condition, avoid complex blocks or closures with blocks; inste
error: omit braces around single expression condition
--> $DIR/block_in_if_condition.rs:46:8
|
46 | if { true } {
LL | if { true } {
| ^^^^^^^^
|
= note: `-D clippy::block-in-if-condition-expr` implied by `-D warnings`
@ -33,27 +33,27 @@ error: omit braces around single expression condition
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/block_in_if_condition.rs:66:17
|
66 | |x| {
LL | |x| {
| _________________^
67 | | let target = 3;
68 | | x == target
69 | | },
LL | | let target = 3;
LL | | x == target
LL | | },
| |_____________^
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/block_in_if_condition.rs:75:13
|
75 | |x| {
LL | |x| {
| _____________^
76 | | let target = 3;
77 | | x == target
78 | | },
LL | | let target = 3;
LL | | x == target
LL | | },
| |_________^
error: this boolean expression can be simplified
--> $DIR/block_in_if_condition.rs:85:8
|
85 | if true && x == 3 {
LL | if true && x == 3 {
| ^^^^^^^^^^^^^^ help: try: `x == 3`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`

View file

@ -1,7 +1,7 @@
error: equality checks against true are unnecessary
--> $DIR/bool_comparison.rs:13:8
|
13 | if x == true {
LL | if x == true {
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
= note: `-D clippy::bool-comparison` implied by `-D warnings`
@ -9,79 +9,79 @@ error: equality checks against true are unnecessary
error: equality checks against false can be replaced by a negation
--> $DIR/bool_comparison.rs:18:8
|
18 | if x == false {
LL | if x == false {
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: equality checks against true are unnecessary
--> $DIR/bool_comparison.rs:23:8
|
23 | if true == x {
LL | if true == x {
| ^^^^^^^^^ help: try simplifying it as shown: `x`
error: equality checks against false can be replaced by a negation
--> $DIR/bool_comparison.rs:28:8
|
28 | if false == x {
LL | if false == x {
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: inequality checks against true can be replaced by a negation
--> $DIR/bool_comparison.rs:33:8
|
33 | if x != true {
LL | if x != true {
| ^^^^^^^^^ help: try simplifying it as shown: `!x`
error: inequality checks against false are unnecessary
--> $DIR/bool_comparison.rs:38:8
|
38 | if x != false {
LL | if x != false {
| ^^^^^^^^^^ help: try simplifying it as shown: `x`
error: inequality checks against true can be replaced by a negation
--> $DIR/bool_comparison.rs:43:8
|
43 | if true != x {
LL | if true != x {
| ^^^^^^^^^ help: try simplifying it as shown: `!x`
error: inequality checks against false are unnecessary
--> $DIR/bool_comparison.rs:48:8
|
48 | if false != x {
LL | if false != x {
| ^^^^^^^^^^ help: try simplifying it as shown: `x`
error: less than comparison against true can be replaced by a negation
--> $DIR/bool_comparison.rs:53:8
|
53 | if x < true {
LL | if x < true {
| ^^^^^^^^ help: try simplifying it as shown: `!x`
error: greater than checks against false are unnecessary
--> $DIR/bool_comparison.rs:58:8
|
58 | if false < x {
LL | if false < x {
| ^^^^^^^^^ help: try simplifying it as shown: `x`
error: greater than checks against false are unnecessary
--> $DIR/bool_comparison.rs:63:8
|
63 | if x > false {
LL | if x > false {
| ^^^^^^^^^ help: try simplifying it as shown: `x`
error: less than comparison against true can be replaced by a negation
--> $DIR/bool_comparison.rs:68:8
|
68 | if true > x {
LL | if true > x {
| ^^^^^^^^ help: try simplifying it as shown: `!x`
error: order comparisons between booleans can be simplified
--> $DIR/bool_comparison.rs:74:8
|
74 | if x < y {
LL | if x < y {
| ^^^^^ help: try simplifying it as shown: `!x & y`
error: order comparisons between booleans can be simplified
--> $DIR/bool_comparison.rs:79:8
|
79 | if x > y {
LL | if x > y {
| ^^^^^ help: try simplifying it as shown: `x & !y`
error: aborting due to 14 previous errors

View file

@ -1,20 +1,20 @@
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:19:13
|
19 | let _ = a && b || a;
LL | let _ = a && b || a;
| ^^^^^^^^^^^ help: it would look like the following: `a`
|
= note: `-D clippy::logic-bug` implied by `-D warnings`
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:19:18
|
19 | let _ = a && b || a;
LL | let _ = a && b || a;
| ^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:21:13
|
21 | let _ = !true;
LL | let _ = !true;
| ^^^^^ help: try: `false`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
@ -22,182 +22,182 @@ error: this boolean expression can be simplified
error: this boolean expression can be simplified
--> $DIR/booleans.rs:22:13
|
22 | let _ = !false;
LL | let _ = !false;
| ^^^^^^ help: try: `true`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:23:13
|
23 | let _ = !!a;
LL | let _ = !!a;
| ^^^ help: try: `a`
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:24:13
|
24 | let _ = false && a;
LL | let _ = false && a;
| ^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:24:22
|
24 | let _ = false && a;
LL | let _ = false && a;
| ^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:25:13
|
25 | let _ = false || a;
LL | let _ = false || a;
| ^^^^^^^^^^ help: try: `a`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:30:13
|
30 | let _ = !(!a && b);
LL | let _ = !(!a && b);
| ^^^^^^^^^^ help: try: `!b || a`
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:40:13
|
40 | let _ = a == b && a != b;
LL | let _ = a == b && a != b;
| ^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:40:13
|
40 | let _ = a == b && a != b;
LL | let _ = a == b && a != b;
| ^^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:41:13
|
41 | let _ = a == b && c == 5 && a == b;
LL | let _ = a == b && c == 5 && a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
41 | let _ = a == b && c == 5;
LL | let _ = a == b && c == 5;
| ^^^^^^^^^^^^^^^^
41 | let _ = !(c != 5 || a != b);
LL | let _ = !(c != 5 || a != b);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:42:13
|
42 | let _ = a == b && c == 5 && b == a;
LL | let _ = a == b && c == 5 && b == a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
42 | let _ = a == b && c == 5;
LL | let _ = a == b && c == 5;
| ^^^^^^^^^^^^^^^^
42 | let _ = !(c != 5 || a != b);
LL | let _ = !(c != 5 || a != b);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:43:13
|
43 | let _ = a < b && a >= b;
LL | let _ = a < b && a >= b;
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:43:13
|
43 | let _ = a < b && a >= b;
LL | let _ = a < b && a >= b;
| ^^^^^
error: this boolean expression contains a logic bug
--> $DIR/booleans.rs:44:13
|
44 | let _ = a > b && a <= b;
LL | let _ = a > b && a <= b;
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
|
help: this expression can be optimized out by applying boolean operations to the outer expression
--> $DIR/booleans.rs:44:13
|
44 | let _ = a > b && a <= b;
LL | let _ = a > b && a <= b;
| ^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:46:13
|
46 | let _ = a != b || !(a != b || c == d);
LL | let _ = a != b || !(a != b || c == d);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try
|
46 | let _ = c != d || a != b;
LL | let _ = c != d || a != b;
| ^^^^^^^^^^^^^^^^
46 | let _ = !(a == b && c == d);
LL | let _ = !(a == b && c == d);
| ^^^^^^^^^^^^^^^^^^^
error: this boolean expression can be simplified
--> $DIR/booleans.rs:54:13
|
54 | let _ = !a.is_some();
LL | let _ = !a.is_some();
| ^^^^^^^^^^^^ help: try: `a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:56:13
|
56 | let _ = !a.is_none();
LL | let _ = !a.is_none();
| ^^^^^^^^^^^^ help: try: `a.is_some()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:58:13
|
58 | let _ = !b.is_err();
LL | let _ = !b.is_err();
| ^^^^^^^^^^^ help: try: `b.is_ok()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:60:13
|
60 | let _ = !b.is_ok();
LL | let _ = !b.is_ok();
| ^^^^^^^^^^ help: try: `b.is_err()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:62:13
|
62 | let _ = !(a.is_some() && !c);
LL | let _ = !(a.is_some() && !c);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:63:13
|
63 | let _ = !(!c ^ c) || !a.is_some();
LL | let _ = !(!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:64:13
|
64 | let _ = (!c ^ c) || !a.is_some();
LL | let _ = (!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:65:13
|
65 | let _ = !c ^ c || !a.is_some();
LL | let _ = !c ^ c || !a.is_some();
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:137:8
|
137 | if !res.is_ok() {}
| ^^^^^^^^^^^^ help: try: `res.is_err()`
--> $DIR/booleans.rs:137:8
|
LL | if !res.is_ok() {}
| ^^^^^^^^^^^^ help: try: `res.is_err()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:138:8
|
138 | if !res.is_err() {}
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
--> $DIR/booleans.rs:138:8
|
LL | if !res.is_err() {}
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:141:8
|
141 | if !res.is_some() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
--> $DIR/booleans.rs:141:8
|
LL | if !res.is_some() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
error: this boolean expression can be simplified
--> $DIR/booleans.rs:142:8
|
142 | if !res.is_none() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`
--> $DIR/booleans.rs:142:8
|
LL | if !res.is_none() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`
error: aborting due to 25 previous errors

View file

@ -1,31 +1,31 @@
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:15:19
|
15 | pub fn test1(foo: &mut Box<bool>) {
LL | pub fn test1(foo: &mut Box<bool>) {
| ^^^^^^^^^^^^^^ help: try: `&mut bool`
|
note: lint level defined here
--> $DIR/borrow_box.rs:10:9
|
10 | #![deny(clippy::borrowed_box)]
LL | #![deny(clippy::borrowed_box)]
| ^^^^^^^^^^^^^^^^^^^^
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:20:14
|
20 | let foo: &Box<bool>;
LL | let foo: &Box<bool>;
| ^^^^^^^^^^ help: try: `&bool`
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:24:10
|
24 | foo: &'a Box<bool>,
LL | foo: &'a Box<bool>,
| ^^^^^^^^^^^^^ help: try: `&'a bool`
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:28:17
|
28 | fn test4(a: &Box<bool>);
LL | fn test4(a: &Box<bool>);
| ^^^^^^^^^^ help: try: `&bool`
error: aborting due to 4 previous errors

View file

@ -1,7 +1,7 @@
error: you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`
--> $DIR/box_vec.rs:23:18
|
23 | pub fn test(foo: Box<Vec<bool>>) {
LL | pub fn test(foo: Box<Vec<bool>>) {
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::box-vec` implied by `-D warnings`

View file

@ -8,6 +8,7 @@
// except according to those terms.
#![warn(clippy::builtin_type_shadow)]
#![allow(non_camel_case_types)]
fn foo<u32>(a: u32) -> u32 {
42

View file

@ -1,17 +1,17 @@
error: This generic shadows the built-in type `u32`
--> $DIR/builtin-type-shadow.rs:12:8
--> $DIR/builtin-type-shadow.rs:13:8
|
12 | fn foo<u32>(a: u32) -> u32 {
LL | fn foo<u32>(a: u32) -> u32 {
| ^^^
|
= note: `-D clippy::builtin-type-shadow` implied by `-D warnings`
error[E0308]: mismatched types
--> $DIR/builtin-type-shadow.rs:13:5
--> $DIR/builtin-type-shadow.rs:14:5
|
12 | fn foo<u32>(a: u32) -> u32 {
LL | fn foo<u32>(a: u32) -> u32 {
| --- expected `u32` because of return type
13 | 42
LL | 42
| ^^ expected type parameter, found integral variable
|
= note: expected type `u32`

View file

@ -1,25 +1,25 @@
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:14:13
|
14 | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
LL | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)`
|
note: lint level defined here
--> $DIR/bytecount.rs:10:8
|
10 | #[deny(clippy::naive_bytecount)]
LL | #[deny(clippy::naive_bytecount)]
| ^^^^^^^^^^^^^^^^^^^^^^^
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:16:13
|
16 | let _ = (&x[..]).iter().filter(|&a| *a == 0).count(); // naive byte count
LL | let _ = (&x[..]).iter().filter(|&a| *a == 0).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count((&x[..]), 0)`
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:28:13
|
28 | let _ = x.iter().filter(|a| b + 1 == **a).count(); // naive byte count
LL | let _ = x.iter().filter(|a| b + 1 == **a).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, b + 1)`
error: aborting due to 3 previous errors

View file

@ -1,7 +1,7 @@
error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast.rs:20:5
|
20 | 1i32 as f32;
LL | 1i32 as f32;
| ^^^^^^^^^^^
|
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
@ -9,37 +9,37 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f
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:21:5
|
21 | 1i64 as f32;
LL | 1i64 as f32;
| ^^^^^^^^^^^
error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast.rs:22:5
|
22 | 1i64 as f64;
LL | 1i64 as f64;
| ^^^^^^^^^^^
error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast.rs:23:5
|
23 | 1u32 as f32;
LL | 1u32 as f32;
| ^^^^^^^^^^^
error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast.rs:24:5
|
24 | 1u64 as f32;
LL | 1u64 as f32;
| ^^^^^^^^^^^
error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast.rs:25:5
|
25 | 1u64 as f64;
LL | 1u64 as f64;
| ^^^^^^^^^^^
error: casting f32 to i32 may truncate the value
--> $DIR/cast.rs:27:5
|
27 | 1f32 as i32;
LL | 1f32 as i32;
| ^^^^^^^^^^^
|
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
@ -47,13 +47,13 @@ error: casting f32 to i32 may truncate the value
error: casting f32 to u32 may truncate the value
--> $DIR/cast.rs:28:5
|
28 | 1f32 as u32;
LL | 1f32 as u32;
| ^^^^^^^^^^^
error: casting f32 to u32 may lose the sign of the value
--> $DIR/cast.rs:28:5
|
28 | 1f32 as u32;
LL | 1f32 as u32;
| ^^^^^^^^^^^
|
= note: `-D clippy::cast-sign-loss` implied by `-D warnings`
@ -61,49 +61,49 @@ error: casting f32 to u32 may lose the sign of the value
error: casting f64 to f32 may truncate the value
--> $DIR/cast.rs:29:5
|
29 | 1f64 as f32;
LL | 1f64 as f32;
| ^^^^^^^^^^^
error: casting i32 to i8 may truncate the value
--> $DIR/cast.rs:30:5
|
30 | 1i32 as i8;
LL | 1i32 as i8;
| ^^^^^^^^^^
error: casting i32 to u8 may lose the sign of the value
--> $DIR/cast.rs:31:5
|
31 | 1i32 as u8;
LL | 1i32 as u8;
| ^^^^^^^^^^
error: casting i32 to u8 may truncate the value
--> $DIR/cast.rs:31:5
|
31 | 1i32 as u8;
LL | 1i32 as u8;
| ^^^^^^^^^^
error: casting f64 to isize may truncate the value
--> $DIR/cast.rs:32:5
|
32 | 1f64 as isize;
LL | 1f64 as isize;
| ^^^^^^^^^^^^^
error: casting f64 to usize may truncate the value
--> $DIR/cast.rs:33:5
|
33 | 1f64 as usize;
LL | 1f64 as usize;
| ^^^^^^^^^^^^^
error: casting f64 to usize may lose the sign of the value
--> $DIR/cast.rs:33:5
|
33 | 1f64 as usize;
LL | 1f64 as usize;
| ^^^^^^^^^^^^^
error: casting u8 to i8 may wrap around the value
--> $DIR/cast.rs:35:5
|
35 | 1u8 as i8;
LL | 1u8 as i8;
| ^^^^^^^^^
|
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
@ -111,31 +111,31 @@ error: casting u8 to i8 may wrap around the value
error: casting u16 to i16 may wrap around the value
--> $DIR/cast.rs:36:5
|
36 | 1u16 as i16;
LL | 1u16 as i16;
| ^^^^^^^^^^^
error: casting u32 to i32 may wrap around the value
--> $DIR/cast.rs:37:5
|
37 | 1u32 as i32;
LL | 1u32 as i32;
| ^^^^^^^^^^^
error: casting u64 to i64 may wrap around the value
--> $DIR/cast.rs:38:5
|
38 | 1u64 as i64;
LL | 1u64 as i64;
| ^^^^^^^^^^^
error: casting usize to isize may wrap around the value
--> $DIR/cast.rs:39:5
|
39 | 1usize as isize;
LL | 1usize as isize;
| ^^^^^^^^^^^^^^^
error: casting f32 to f64 may become silently lossy if types change
--> $DIR/cast.rs:41:5
|
41 | 1.0f32 as f64;
LL | 1.0f32 as f64;
| ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)`
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
@ -143,25 +143,25 @@ error: casting f32 to f64 may become silently lossy if types change
error: casting u8 to u16 may become silently lossy if types change
--> $DIR/cast.rs:43:5
|
43 | (1u8 + 1u8) as u16;
LL | (1u8 + 1u8) as u16;
| ^^^^^^^^^^^^^^^^^^ help: try: `u16::from(1u8 + 1u8)`
error: casting i32 to u32 may lose the sign of the value
--> $DIR/cast.rs:45:5
|
45 | 1i32 as u32;
LL | 1i32 as u32;
| ^^^^^^^^^^^
error: casting isize to usize may lose the sign of the value
--> $DIR/cast.rs:46:5
|
46 | 1isize as usize;
LL | 1isize as usize;
| ^^^^^^^^^^^^^^^
error: casting to the same type is unnecessary (`i32` -> `i32`)
--> $DIR/cast.rs:49:5
|
49 | 1i32 as i32;
LL | 1i32 as i32;
| ^^^^^^^^^^^
|
= note: `-D clippy::unnecessary-cast` implied by `-D warnings`
@ -169,13 +169,13 @@ error: casting to the same type is unnecessary (`i32` -> `i32`)
error: casting to the same type is unnecessary (`f32` -> `f32`)
--> $DIR/cast.rs:50:5
|
50 | 1f32 as f32;
LL | 1f32 as f32;
| ^^^^^^^^^^^
error: casting to the same type is unnecessary (`bool` -> `bool`)
--> $DIR/cast.rs:51:5
|
51 | false as bool;
LL | false as bool;
| ^^^^^^^^^^^^^
error: aborting due to 28 previous errors

View file

@ -9,7 +9,6 @@
//! Test casts for alignment issues
#![feature(rustc_private)]
extern crate libc;

View file

@ -1,15 +1,15 @@
error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`)
--> $DIR/cast_alignment.rs:22:5
--> $DIR/cast_alignment.rs:21:5
|
22 | (&1u8 as *const u8) as *const u16;
LL | (&1u8 as *const u8) as *const u16;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cast-ptr-alignment` implied by `-D warnings`
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`)
--> $DIR/cast_alignment.rs:23:5
--> $DIR/cast_alignment.rs:22:5
|
23 | (&mut 1u8 as *mut u8) as *mut u16;
LL | (&mut 1u8 as *mut u8) as *mut u16;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,7 +1,7 @@
error: casting i8 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:14:5
|
14 | 1i8 as f32;
LL | 1i8 as f32;
| ^^^^^^^^^^ help: try: `f32::from(1i8)`
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
@ -9,55 +9,55 @@ error: casting i8 to f32 may become silently lossy if types change
error: casting i8 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:15:5
|
15 | 1i8 as f64;
LL | 1i8 as f64;
| ^^^^^^^^^^ help: try: `f64::from(1i8)`
error: casting u8 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:16:5
|
16 | 1u8 as f32;
LL | 1u8 as f32;
| ^^^^^^^^^^ help: try: `f32::from(1u8)`
error: casting u8 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:17:5
|
17 | 1u8 as f64;
LL | 1u8 as f64;
| ^^^^^^^^^^ help: try: `f64::from(1u8)`
error: casting i16 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:18:5
|
18 | 1i16 as f32;
LL | 1i16 as f32;
| ^^^^^^^^^^^ help: try: `f32::from(1i16)`
error: casting i16 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:19:5
|
19 | 1i16 as f64;
LL | 1i16 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1i16)`
error: casting u16 to f32 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:20:5
|
20 | 1u16 as f32;
LL | 1u16 as f32;
| ^^^^^^^^^^^ help: try: `f32::from(1u16)`
error: casting u16 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:21:5
|
21 | 1u16 as f64;
LL | 1u16 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1u16)`
error: casting i32 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:22:5
|
22 | 1i32 as f64;
LL | 1i32 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1i32)`
error: casting u32 to f64 may become silently lossy if types change
--> $DIR/cast_lossless_float.rs:23:5
|
23 | 1u32 as f64;
LL | 1u32 as f64;
| ^^^^^^^^^^^ help: try: `f64::from(1u32)`
error: aborting due to 10 previous errors

View file

@ -1,7 +1,7 @@
error: casting i8 to i16 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:14:5
|
14 | 1i8 as i16;
LL | 1i8 as i16;
| ^^^^^^^^^^ help: try: `i16::from(1i8)`
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
@ -9,103 +9,103 @@ error: casting i8 to i16 may become silently lossy if types change
error: casting i8 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:15:5
|
15 | 1i8 as i32;
LL | 1i8 as i32;
| ^^^^^^^^^^ help: try: `i32::from(1i8)`
error: casting i8 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:16:5
|
16 | 1i8 as i64;
LL | 1i8 as i64;
| ^^^^^^^^^^ help: try: `i64::from(1i8)`
error: casting u8 to i16 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:17:5
|
17 | 1u8 as i16;
LL | 1u8 as i16;
| ^^^^^^^^^^ help: try: `i16::from(1u8)`
error: casting u8 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:18:5
|
18 | 1u8 as i32;
LL | 1u8 as i32;
| ^^^^^^^^^^ help: try: `i32::from(1u8)`
error: casting u8 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:19:5
|
19 | 1u8 as i64;
LL | 1u8 as i64;
| ^^^^^^^^^^ help: try: `i64::from(1u8)`
error: casting u8 to u16 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:20:5
|
20 | 1u8 as u16;
LL | 1u8 as u16;
| ^^^^^^^^^^ help: try: `u16::from(1u8)`
error: casting u8 to u32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:21:5
|
21 | 1u8 as u32;
LL | 1u8 as u32;
| ^^^^^^^^^^ help: try: `u32::from(1u8)`
error: casting u8 to u64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:22:5
|
22 | 1u8 as u64;
LL | 1u8 as u64;
| ^^^^^^^^^^ help: try: `u64::from(1u8)`
error: casting i16 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:23:5
|
23 | 1i16 as i32;
LL | 1i16 as i32;
| ^^^^^^^^^^^ help: try: `i32::from(1i16)`
error: casting i16 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:24:5
|
24 | 1i16 as i64;
LL | 1i16 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1i16)`
error: casting u16 to i32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:25:5
|
25 | 1u16 as i32;
LL | 1u16 as i32;
| ^^^^^^^^^^^ help: try: `i32::from(1u16)`
error: casting u16 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:26:5
|
26 | 1u16 as i64;
LL | 1u16 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1u16)`
error: casting u16 to u32 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:27:5
|
27 | 1u16 as u32;
LL | 1u16 as u32;
| ^^^^^^^^^^^ help: try: `u32::from(1u16)`
error: casting u16 to u64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:28:5
|
28 | 1u16 as u64;
LL | 1u16 as u64;
| ^^^^^^^^^^^ help: try: `u64::from(1u16)`
error: casting i32 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:29:5
|
29 | 1i32 as i64;
LL | 1i32 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1i32)`
error: casting u32 to i64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:30:5
|
30 | 1u32 as i64;
LL | 1u32 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1u32)`
error: casting u32 to u64 may become silently lossy if types change
--> $DIR/cast_lossless_integer.rs:31:5
|
31 | 1u32 as u64;
LL | 1u32 as u64;
| ^^^^^^^^^^^ help: try: `u64::from(1u32)`
error: aborting due to 18 previous errors

View file

@ -1,7 +1,7 @@
error: casting isize to i8 may truncate the value
--> $DIR/cast_size.rs:20:5
|
20 | 1isize as i8;
LL | 1isize as i8;
| ^^^^^^^^^^^^
|
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
@ -9,7 +9,7 @@ error: casting isize to i8 may truncate the value
error: casting isize to f64 causes a loss of precision on targets with 64-bit wide pointers (isize is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast_size.rs:21:5
|
21 | 1isize as f64;
LL | 1isize as f64;
| ^^^^^^^^^^^^^
|
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
@ -17,31 +17,31 @@ error: casting isize to f64 causes a loss of precision on targets with 64-bit wi
error: casting usize to f64 causes a loss of precision on targets with 64-bit wide pointers (usize is 64 bits wide, but f64's mantissa is only 52 bits wide)
--> $DIR/cast_size.rs:22:5
|
22 | 1usize as f64;
LL | 1usize as f64;
| ^^^^^^^^^^^^^
error: casting isize to f32 causes a loss of precision (isize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast_size.rs:23:5
|
23 | 1isize as f32;
LL | 1isize as f32;
| ^^^^^^^^^^^^^
error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
--> $DIR/cast_size.rs:24:5
|
24 | 1usize as f32;
LL | 1usize as f32;
| ^^^^^^^^^^^^^
error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:25:5
|
25 | 1isize as i32;
LL | 1isize as i32;
| ^^^^^^^^^^^^^
error: casting isize to u32 may lose the sign of the value
--> $DIR/cast_size.rs:26:5
|
26 | 1isize as u32;
LL | 1isize as u32;
| ^^^^^^^^^^^^^
|
= note: `-D clippy::cast-sign-loss` implied by `-D warnings`
@ -49,25 +49,25 @@ error: casting isize to u32 may lose the sign of the value
error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:26:5
|
26 | 1isize as u32;
LL | 1isize as u32;
| ^^^^^^^^^^^^^
error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:27:5
|
27 | 1usize as u32;
LL | 1usize as u32;
| ^^^^^^^^^^^^^
error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:28:5
|
28 | 1usize as i32;
LL | 1usize as i32;
| ^^^^^^^^^^^^^
error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:28:5
|
28 | 1usize as i32;
LL | 1usize as i32;
| ^^^^^^^^^^^^^
|
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
@ -75,49 +75,49 @@ error: casting usize to i32 may wrap around the value on targets with 32-bit wid
error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:30:5
|
30 | 1i64 as isize;
LL | 1i64 as isize;
| ^^^^^^^^^^^^^
error: casting i64 to usize may lose the sign of the value
--> $DIR/cast_size.rs:31:5
|
31 | 1i64 as usize;
LL | 1i64 as usize;
| ^^^^^^^^^^^^^
error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:31:5
|
31 | 1i64 as usize;
LL | 1i64 as usize;
| ^^^^^^^^^^^^^
error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:32:5
|
32 | 1u64 as isize;
LL | 1u64 as isize;
| ^^^^^^^^^^^^^
error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:32:5
|
32 | 1u64 as isize;
LL | 1u64 as isize;
| ^^^^^^^^^^^^^
error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:33:5
|
33 | 1u64 as usize;
LL | 1u64 as usize;
| ^^^^^^^^^^^^^
error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:34:5
|
34 | 1u32 as isize;
LL | 1u32 as isize;
| ^^^^^^^^^^^^^
error: casting i32 to usize may lose the sign of the value
--> $DIR/cast_size.rs:37:5
|
37 | 1i32 as usize;
LL | 1i32 as usize;
| ^^^^^^^^^^^^^
error: aborting due to 19 previous errors

View file

@ -1,7 +1,7 @@
error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes
--> $DIR/cfg_attr_rustfmt.rs:25:5
|
25 | #[cfg_attr(rustfmt, rustfmt::skip)]
LL | #[cfg_attr(rustfmt, rustfmt::skip)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]`
|
= note: `-D clippy::deprecated-cfg-attr` implied by `-D warnings`
@ -9,13 +9,13 @@ error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes
error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes
--> $DIR/cfg_attr_rustfmt.rs:29:1
|
29 | #[cfg_attr(rustfmt, rustfmt_skip)]
LL | #[cfg_attr(rustfmt, rustfmt_skip)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]`
error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes
--> $DIR/cfg_attr_rustfmt.rs:35:5
|
35 | #![cfg_attr(rustfmt, rustfmt_skip)]
LL | #![cfg_attr(rustfmt, rustfmt_skip)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#![rustfmt::skip]`
error: aborting due to 3 previous errors

View file

@ -1,7 +1,7 @@
error: casting character literal to u8. `char`s are 4 bytes wide in rust, so casting to u8 truncates them
--> $DIR/char_lit_as_u8.rs:13:13
|
13 | let c = 'a' as u8;
LL | let c = 'a' as u8;
| ^^^^^^^^^
|
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`

View file

@ -1,313 +1,313 @@
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:16:9
|
15 | if x.is_some() {
LL | if x.is_some() {
| ----------- the check is happening here
16 | x.unwrap(); // unnecessary
LL | x.unwrap(); // unnecessary
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/checked_unwrap.rs:10:35
|
10 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:18:9
|
15 | if x.is_some() {
LL | if x.is_some() {
| ----------- because of this check
...
18 | x.unwrap(); // will panic
LL | x.unwrap(); // will panic
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/checked_unwrap.rs:10:9
|
10 | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:21:9
|
20 | if x.is_none() {
LL | if x.is_none() {
| ----------- because of this check
21 | x.unwrap(); // will panic
LL | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:23:9
|
20 | if x.is_none() {
LL | if x.is_none() {
| ----------- the check is happening here
...
23 | x.unwrap(); // unnecessary
LL | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:27:9
|
26 | if x.is_ok() {
LL | if x.is_ok() {
| --------- the check is happening here
27 | x.unwrap(); // unnecessary
LL | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:28:9
|
26 | if x.is_ok() {
LL | if x.is_ok() {
| --------- because of this check
27 | x.unwrap(); // unnecessary
28 | x.unwrap_err(); // will panic
LL | x.unwrap(); // unnecessary
LL | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:30:9
|
26 | if x.is_ok() {
LL | if x.is_ok() {
| --------- because of this check
...
30 | x.unwrap(); // will panic
LL | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:31:9
|
26 | if x.is_ok() {
LL | if x.is_ok() {
| --------- the check is happening here
...
31 | x.unwrap_err(); // unnecessary
LL | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:34:9
|
33 | if x.is_err() {
LL | if x.is_err() {
| ---------- because of this check
34 | x.unwrap(); // will panic
LL | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:35:9
|
33 | if x.is_err() {
LL | if x.is_err() {
| ---------- the check is happening here
34 | x.unwrap(); // will panic
35 | x.unwrap_err(); // unnecessary
LL | x.unwrap(); // will panic
LL | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:37:9
|
33 | if x.is_err() {
LL | if x.is_err() {
| ---------- the check is happening here
...
37 | x.unwrap(); // unnecessary
LL | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:38:9
|
33 | if x.is_err() {
LL | if x.is_err() {
| ---------- because of this check
...
38 | x.unwrap_err(); // will panic
LL | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:55:9
|
54 | if x.is_ok() && y.is_err() {
LL | if x.is_ok() && y.is_err() {
| --------- the check is happening here
55 | x.unwrap(); // unnecessary
LL | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:56:9
|
54 | if x.is_ok() && y.is_err() {
LL | if x.is_ok() && y.is_err() {
| --------- because of this check
55 | x.unwrap(); // unnecessary
56 | x.unwrap_err(); // will panic
LL | x.unwrap(); // unnecessary
LL | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:57:9
|
54 | if x.is_ok() && y.is_err() {
LL | if x.is_ok() && y.is_err() {
| ---------- because of this check
...
57 | y.unwrap(); // will panic
LL | y.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:58:9
|
54 | if x.is_ok() && y.is_err() {
LL | if x.is_ok() && y.is_err() {
| ---------- the check is happening here
...
58 | y.unwrap_err(); // unnecessary
LL | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:72:9
|
67 | if x.is_ok() || y.is_ok() {
LL | if x.is_ok() || y.is_ok() {
| --------- because of this check
...
72 | x.unwrap(); // will panic
LL | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:73:9
|
67 | if x.is_ok() || y.is_ok() {
LL | if x.is_ok() || y.is_ok() {
| --------- the check is happening here
...
73 | x.unwrap_err(); // unnecessary
LL | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:74:9
|
67 | if x.is_ok() || y.is_ok() {
LL | if x.is_ok() || y.is_ok() {
| --------- because of this check
...
74 | y.unwrap(); // will panic
LL | y.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:75:9
|
67 | if x.is_ok() || y.is_ok() {
LL | if x.is_ok() || y.is_ok() {
| --------- the check is happening here
...
75 | y.unwrap_err(); // unnecessary
LL | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:79:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
LL | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
79 | x.unwrap(); // unnecessary
LL | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:80:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
LL | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
79 | x.unwrap(); // unnecessary
80 | x.unwrap_err(); // will panic
LL | x.unwrap(); // unnecessary
LL | x.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:81:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
LL | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- because of this check
...
81 | y.unwrap(); // will panic
LL | y.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:82:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
LL | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| --------- the check is happening here
...
82 | y.unwrap_err(); // unnecessary
LL | y.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:83:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
LL | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| ---------- the check is happening here
...
83 | z.unwrap(); // unnecessary
LL | z.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:84:9
|
78 | if x.is_ok() && !(y.is_ok() || z.is_err()) {
LL | if x.is_ok() && !(y.is_ok() || z.is_err()) {
| ---------- because of this check
...
84 | z.unwrap_err(); // will panic
LL | z.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:92:9
|
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
LL | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- because of this check
...
92 | x.unwrap(); // will panic
LL | x.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:93:9
|
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
LL | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- the check is happening here
...
93 | x.unwrap_err(); // unnecessary
LL | x.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:94:9
|
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
LL | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- the check is happening here
...
94 | y.unwrap(); // unnecessary
LL | y.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap_err()` will always panic.
--> $DIR/checked_unwrap.rs:95:9
|
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
LL | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| --------- because of this check
...
95 | y.unwrap_err(); // will panic
LL | y.unwrap_err(); // will panic
| ^^^^^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:96:9
|
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
LL | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| ---------- because of this check
...
96 | z.unwrap(); // will panic
LL | z.unwrap(); // will panic
| ^^^^^^^^^^
error: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:97:9
|
86 | if x.is_ok() || !(y.is_ok() && z.is_err()) {
LL | if x.is_ok() || !(y.is_ok() && z.is_err()) {
| ---------- the check is happening here
...
97 | z.unwrap_err(); // unnecessary
LL | z.unwrap_err(); // unnecessary
| ^^^^^^^^^^^^^^
error: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> $DIR/checked_unwrap.rs:105:13
|
104 | if x.is_some() {
| ----------- the check is happening here
105 | x.unwrap(); // unnecessary
| ^^^^^^^^^^
--> $DIR/checked_unwrap.rs:105:13
|
LL | if x.is_some() {
| ----------- the check is happening here
LL | x.unwrap(); // unnecessary
| ^^^^^^^^^^
error: This call to `unwrap()` will always panic.
--> $DIR/checked_unwrap.rs:107:13
|
104 | if x.is_some() {
| ----------- because of this check
--> $DIR/checked_unwrap.rs:107:13
|
LL | if x.is_some() {
| ----------- because of this check
...
107 | x.unwrap(); // will panic
| ^^^^^^^^^^
LL | x.unwrap(); // will panic
| ^^^^^^^^^^
error: aborting due to 34 previous errors

View file

@ -1,7 +1,7 @@
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:14:5
|
14 | x == std::f32::NAN;
LL | x == std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cmp-nan` implied by `-D warnings`
@ -9,67 +9,67 @@ error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:15:5
|
15 | x != std::f32::NAN;
LL | x != std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:16:5
|
16 | x < std::f32::NAN;
LL | x < std::f32::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:17:5
|
17 | x > std::f32::NAN;
LL | x > std::f32::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:18:5
|
18 | x <= std::f32::NAN;
LL | x <= std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:19:5
|
19 | x >= std::f32::NAN;
LL | x >= std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:22:5
|
22 | y == std::f64::NAN;
LL | y == std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:23:5
|
23 | y != std::f64::NAN;
LL | y != std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:24:5
|
24 | y < std::f64::NAN;
LL | y < std::f64::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:25:5
|
25 | y > std::f64::NAN;
LL | y > std::f64::NAN;
| ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:26:5
|
26 | y <= std::f64::NAN;
LL | y <= std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:27:5
|
27 | y >= std::f64::NAN;
LL | y >= std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors

View file

@ -1,7 +1,7 @@
error: Comparing with null is better expressed by the .is_null() method
--> $DIR/cmp_null.rs:18:8
|
18 | if p == ptr::null() {
LL | if p == ptr::null() {
| ^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cmp-null` implied by `-D warnings`
@ -9,7 +9,7 @@ error: Comparing with null is better expressed by the .is_null() method
error: Comparing with null is better expressed by the .is_null() method
--> $DIR/cmp_null.rs:23:8
|
23 | if m == ptr::null_mut() {
LL | if m == ptr::null_mut() {
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,7 +1,7 @@
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:14:14
|
14 | x != "foo".to_string();
LL | x != "foo".to_string();
| ^^^^^^^^^^^^^^^^^ help: try: `"foo"`
|
= note: `-D clippy::cmp-owned` implied by `-D warnings`
@ -9,49 +9,49 @@ error: this creates an owned instance just for comparison
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:16:9
|
16 | "foo".to_string() != x;
LL | "foo".to_string() != x;
| ^^^^^^^^^^^^^^^^^ help: try: `"foo"`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:23:10
|
23 | x != "foo".to_owned();
LL | x != "foo".to_owned();
| ^^^^^^^^^^^^^^^^ help: try: `"foo"`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:25:10
|
25 | x != String::from("foo");
LL | x != String::from("foo");
| ^^^^^^^^^^^^^^^^^^^ help: try: `"foo"`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:29:5
|
29 | Foo.to_owned() == Foo;
LL | Foo.to_owned() == Foo;
| ^^^^^^^^^^^^^^ help: try: `Foo`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:31:30
|
31 | "abc".chars().filter(|c| c.to_owned() != 'X');
LL | "abc".chars().filter(|c| c.to_owned() != 'X');
| ^^^^^^^^^^^^ help: try: `*c`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:38:5
|
38 | y.to_owned() == *x;
LL | y.to_owned() == *x;
| ^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:43:5
|
43 | y.to_owned() == **x;
LL | y.to_owned() == **x;
| ^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:50:9
|
50 | self.to_owned() == *other
LL | self.to_owned() == *other
| ^^^^^^^^^^^^^^^^^^^^^^^^^ try implementing the comparison without allocating
error: aborting due to 9 previous errors

View file

@ -1,260 +1,260 @@
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:15:5
|
15 | / if x == "hello" {
16 | | if y == "world" {
17 | | println!("Hello world!");
18 | | }
19 | | }
LL | / if x == "hello" {
LL | | if y == "world" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
|
= note: `-D clippy::collapsible-if` implied by `-D warnings`
help: try
|
15 | if x == "hello" && y == "world" {
16 | println!("Hello world!");
17 | }
LL | if x == "hello" && y == "world" {
LL | println!("Hello world!");
LL | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:21:5
|
21 | / if x == "hello" || x == "world" {
22 | | if y == "world" || y == "hello" {
23 | | println!("Hello world!");
24 | | }
25 | | }
LL | / if x == "hello" || x == "world" {
LL | | if y == "world" || y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
|
21 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
22 | println!("Hello world!");
23 | }
LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
LL | println!("Hello world!");
LL | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:27:5
|
27 | / if x == "hello" && x == "world" {
28 | | if y == "world" || y == "hello" {
29 | | println!("Hello world!");
30 | | }
31 | | }
LL | / if x == "hello" && x == "world" {
LL | | if y == "world" || y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
|
27 | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
28 | println!("Hello world!");
29 | }
LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
LL | println!("Hello world!");
LL | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:33:5
|
33 | / if x == "hello" || x == "world" {
34 | | if y == "world" && y == "hello" {
35 | | println!("Hello world!");
36 | | }
37 | | }
LL | / if x == "hello" || x == "world" {
LL | | if y == "world" && y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
|
33 | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
34 | println!("Hello world!");
35 | }
LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
LL | println!("Hello world!");
LL | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:39:5
|
39 | / if x == "hello" && x == "world" {
40 | | if y == "world" && y == "hello" {
41 | | println!("Hello world!");
42 | | }
43 | | }
LL | / if x == "hello" && x == "world" {
LL | | if y == "world" && y == "hello" {
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
|
39 | if x == "hello" && x == "world" && y == "world" && y == "hello" {
40 | println!("Hello world!");
41 | }
LL | if x == "hello" && x == "world" && y == "world" && y == "hello" {
LL | println!("Hello world!");
LL | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:45:5
|
45 | / if 42 == 1337 {
46 | | if 'a' != 'A' {
47 | | println!("world!")
48 | | }
49 | | }
LL | / if 42 == 1337 {
LL | | if 'a' != 'A' {
LL | | println!("world!")
LL | | }
LL | | }
| |_____^
help: try
|
45 | if 42 == 1337 && 'a' != 'A' {
46 | println!("world!")
47 | }
LL | if 42 == 1337 && 'a' != 'A' {
LL | println!("world!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:54:12
|
54 | } else {
LL | } else {
| ____________^
55 | | if y == "world" {
56 | | println!("world!")
57 | | }
58 | | }
LL | | if y == "world" {
LL | | println!("world!")
LL | | }
LL | | }
| |_____^
help: try
|
54 | } else if y == "world" {
55 | println!("world!")
56 | }
LL | } else if y == "world" {
LL | println!("world!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:62:12
|
62 | } else {
LL | } else {
| ____________^
63 | | if let Some(42) = Some(42) {
64 | | println!("world!")
65 | | }
66 | | }
LL | | if let Some(42) = Some(42) {
LL | | println!("world!")
LL | | }
LL | | }
| |_____^
help: try
|
62 | } else if let Some(42) = Some(42) {
63 | println!("world!")
64 | }
LL | } else if let Some(42) = Some(42) {
LL | println!("world!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:70:12
|
70 | } else {
LL | } else {
| ____________^
71 | | if y == "world" {
72 | | println!("world")
73 | | }
LL | | if y == "world" {
LL | | println!("world")
LL | | }
... |
76 | | }
77 | | }
LL | | }
LL | | }
| |_____^
help: try
|
70 | } else if y == "world" {
71 | println!("world")
72 | }
73 | else {
74 | println!("!")
75 | }
LL | } else if y == "world" {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:81:12
|
81 | } else {
LL | } else {
| ____________^
82 | | if let Some(42) = Some(42) {
83 | | println!("world")
84 | | }
LL | | if let Some(42) = Some(42) {
LL | | println!("world")
LL | | }
... |
87 | | }
88 | | }
LL | | }
LL | | }
| |_____^
help: try
|
81 | } else if let Some(42) = Some(42) {
82 | println!("world")
83 | }
84 | else {
85 | println!("!")
86 | }
LL | } else if let Some(42) = Some(42) {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:92:12
|
92 | } else {
LL | } else {
| ____________^
93 | | if let Some(42) = Some(42) {
94 | | println!("world")
95 | | }
LL | | if let Some(42) = Some(42) {
LL | | println!("world")
LL | | }
... |
98 | | }
99 | | }
LL | | }
LL | | }
| |_____^
help: try
|
92 | } else if let Some(42) = Some(42) {
93 | println!("world")
94 | }
95 | else {
96 | println!("!")
97 | }
LL | } else if let Some(42) = Some(42) {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:103:12
|
103 | } else {
| ____________^
104 | | if x == "hello" {
105 | | println!("world")
106 | | }
... |
109 | | }
110 | | }
| |_____^
--> $DIR/collapsible_if.rs:103:12
|
LL | } else {
| ____________^
LL | | if x == "hello" {
LL | | println!("world")
LL | | }
... |
LL | | }
LL | | }
| |_____^
help: try
|
103 | } else if x == "hello" {
104 | println!("world")
105 | }
106 | else {
107 | println!("!")
108 | }
|
|
LL | } else if x == "hello" {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
|
error: this `else { if .. }` block can be collapsed
--> $DIR/collapsible_if.rs:114:12
|
114 | } else {
| ____________^
115 | | if let Some(42) = Some(42) {
116 | | println!("world")
117 | | }
... |
120 | | }
121 | | }
| |_____^
--> $DIR/collapsible_if.rs:114:12
|
LL | } else {
| ____________^
LL | | if let Some(42) = Some(42) {
LL | | println!("world")
LL | | }
... |
LL | | }
LL | | }
| |_____^
help: try
|
114 | } else if let Some(42) = Some(42) {
115 | println!("world")
116 | }
117 | else {
118 | println!("!")
119 | }
|
|
LL | } else if let Some(42) = Some(42) {
LL | println!("world")
LL | }
LL | else {
LL | println!("!")
LL | }
|
error: this if statement can be collapsed
--> $DIR/collapsible_if.rs:173:5
|
173 | / if x == "hello" {
174 | | if y == "world" { // Collapsible
175 | | println!("Hello world!");
176 | | }
177 | | }
| |_____^
--> $DIR/collapsible_if.rs:173:5
|
LL | / if x == "hello" {
LL | | if y == "world" { // Collapsible
LL | | println!("Hello world!");
LL | | }
LL | | }
| |_____^
help: try
|
173 | if x == "hello" && y == "world" { // Collapsible
174 | println!("Hello world!");
175 | }
|
|
LL | if x == "hello" && y == "world" { // Collapsible
LL | println!("Hello world!");
LL | }
|
error: aborting due to 14 previous errors

View file

@ -1,7 +1,7 @@
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:16:12
|
16 | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
LL | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::type-complexity` implied by `-D warnings`
@ -9,85 +9,85 @@ error: very complex type used. Consider factoring parts into `type` definitions
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:17:12
|
17 | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
LL | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:20:8
|
20 | f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
LL | f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:23:11
|
23 | struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
LL | struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:26:11
|
26 | Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
LL | Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:27:17
|
27 | Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
LL | Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:31:14
|
31 | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
LL | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:32:30
|
32 | fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
LL | fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:36:14
|
36 | const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
LL | const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:37:14
|
37 | type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
LL | type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:38:25
|
38 | fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
LL | fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:39:29
|
39 | fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
LL | fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:42:15
|
42 | fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
LL | fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:46:14
|
46 | fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
LL | fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> $DIR/complex_types.rs:49:13
|
49 | let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
LL | let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 15 previous errors

View file

@ -1,7 +1,7 @@
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:13:17
|
13 | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR Consider removing 'static.
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
= note: `-D clippy::const-static-lifetime` implied by `-D warnings`
@ -9,73 +9,73 @@ error: Constants have by default a `'static` lifetime
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:17:21
|
17 | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:19:32
|
19 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:19:47
|
19 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:21:18
|
21 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^------------------ help: consider removing `'static`: `&[&[&'static str]]`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:21:30
|
21 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
LL | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:23:17
|
23 | const VAR_SIX: &'static u8 = &5;
LL | const VAR_SIX: &'static u8 = &5;
| -^^^^^^^--- help: consider removing `'static`: `&u8`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:25:29
|
25 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:25:39
|
25 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
LL | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])];
| -^^^^^^^---- help: consider removing `'static`: `&str`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:27:20
|
27 | const VAR_HEIGHT: &'static Foo = &Foo {};
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:29:19
|
29 | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static.
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:31:19
|
31 | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static.
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
error: Constants have by default a `'static` lifetime
--> $DIR/const_static_lifetime.rs:33:19
|
33 | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static.
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
error: aborting due to 13 previous errors

View file

@ -1,392 +1,392 @@
error: this `if` has identical blocks
--> $DIR/copies.rs:50:12
|
50 | } else {
LL | } else {
| ____________^
51 | | //~ ERROR same body as `if` block
52 | | Foo { bar: 42 };
53 | | 0..10;
LL | | //~ ERROR same body as `if` block
LL | | Foo { bar: 42 };
LL | | 0..10;
... |
58 | | foo();
59 | | }
LL | | foo();
LL | | }
| |_____^
|
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
note: same as this
--> $DIR/copies.rs:42:13
|
42 | if true {
LL | if true {
| _____________^
43 | | Foo { bar: 42 };
44 | | 0..10;
45 | | ..;
LL | | Foo { bar: 42 };
LL | | 0..10;
LL | | ..;
... |
49 | | foo();
50 | | } else {
LL | | foo();
LL | | } else {
| |_____^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:96:14
|
96 | _ => {
| ______________^
97 | | //~ ERROR match arms have same body
98 | | foo();
99 | | let mut a = 42 + [23].len() as i32;
... |
104 | | a
105 | | },
| |_________^
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
--> $DIR/copies.rs:96:14
|
LL | _ => {
| ______________^
LL | | //~ ERROR match arms have same body
LL | | foo();
LL | | let mut a = 42 + [23].len() as i32;
... |
LL | | a
LL | | },
| |_________^
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
note: same as this
--> $DIR/copies.rs:87:15
|
87 | 42 => {
| _______________^
88 | | foo();
89 | | let mut a = 42 + [23].len() as i32;
90 | | if true {
... |
94 | | a
95 | | },
| |_________^
--> $DIR/copies.rs:87:15
|
LL | 42 => {
| _______________^
LL | | foo();
LL | | let mut a = 42 + [23].len() as i32;
LL | | if true {
... |
LL | | a
LL | | },
| |_________^
note: `42` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:87:15
|
87 | 42 => {
| _______________^
88 | | foo();
89 | | let mut a = 42 + [23].len() as i32;
90 | | if true {
... |
94 | | a
95 | | },
| |_________^
--> $DIR/copies.rs:87:15
|
LL | 42 => {
| _______________^
LL | | foo();
LL | | let mut a = 42 + [23].len() as i32;
LL | | if true {
... |
LL | | a
LL | | },
| |_________^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:111:14
|
111 | _ => 0, //~ ERROR match arms have same body
| ^
|
--> $DIR/copies.rs:111:14
|
LL | _ => 0, //~ ERROR match arms have same body
| ^
|
note: same as this
--> $DIR/copies.rs:109:19
|
109 | Abc::A => 0,
| ^
--> $DIR/copies.rs:109:19
|
LL | Abc::A => 0,
| ^
note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:109:19
|
109 | Abc::A => 0,
| ^
--> $DIR/copies.rs:109:19
|
LL | Abc::A => 0,
| ^
error: this `if` has identical blocks
--> $DIR/copies.rs:120:12
|
120 | } else {
| ____________^
121 | | //~ ERROR same body as `if` block
122 | | 42
123 | | };
| |_____^
|
--> $DIR/copies.rs:120:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | 42
LL | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:118:21
|
118 | let _ = if true {
| _____________________^
119 | | 42
120 | | } else {
| |_____^
--> $DIR/copies.rs:118:21
|
LL | let _ = if true {
| _____________________^
LL | | 42
LL | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:134:12
|
134 | } else {
| ____________^
135 | | //~ ERROR same body as `if` block
136 | | for _ in &[42] {
137 | | let foo: &Option<_> = &Some::<u8>(42);
... |
143 | | }
144 | | }
| |_____^
|
--> $DIR/copies.rs:134:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | for _ in &[42] {
LL | | let foo: &Option<_> = &Some::<u8>(42);
... |
LL | | }
LL | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:125:13
|
125 | if true {
| _____________^
126 | | for _ in &[42] {
127 | | let foo: &Option<_> = &Some::<u8>(42);
128 | | if true {
... |
133 | | }
134 | | } else {
| |_____^
--> $DIR/copies.rs:125:13
|
LL | if true {
| _____________^
LL | | for _ in &[42] {
LL | | let foo: &Option<_> = &Some::<u8>(42);
LL | | if true {
... |
LL | | }
LL | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:153:12
|
153 | } else {
| ____________^
154 | | //~ ERROR same body as `if` block
155 | | let bar = if true { 42 } else { 43 };
156 | |
... |
160 | | bar + 1;
161 | | }
| |_____^
|
--> $DIR/copies.rs:153:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | let bar = if true { 42 } else { 43 };
LL | |
... |
LL | | bar + 1;
LL | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:146:13
|
146 | if true {
| _____________^
147 | | let bar = if true { 42 } else { 43 };
148 | |
149 | | while foo() {
... |
152 | | bar + 1;
153 | | } else {
| |_____^
--> $DIR/copies.rs:146:13
|
LL | if true {
| _____________^
LL | | let bar = if true { 42 } else { 43 };
LL | |
LL | | while foo() {
... |
LL | | bar + 1;
LL | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:183:12
|
183 | } else {
| ____________^
184 | | //~ ERROR same body as `if` block
185 | | if let Some(a) = Some(42) {}
186 | | }
| |_____^
|
--> $DIR/copies.rs:183:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | if let Some(a) = Some(42) {}
LL | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:181:13
|
181 | if true {
| _____________^
182 | | if let Some(a) = Some(42) {}
183 | | } else {
| |_____^
--> $DIR/copies.rs:181:13
|
LL | if true {
| _____________^
LL | | if let Some(a) = Some(42) {}
LL | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:190:12
|
190 | } else {
| ____________^
191 | | //~ ERROR same body as `if` block
192 | | if let (1, .., 3) = (1, 2, 3) {}
193 | | }
| |_____^
|
--> $DIR/copies.rs:190:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | if let (1, .., 3) = (1, 2, 3) {}
LL | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:188:13
|
188 | if true {
| _____________^
189 | | if let (1, .., 3) = (1, 2, 3) {}
190 | | } else {
| |_____^
--> $DIR/copies.rs:188:13
|
LL | if true {
| _____________^
LL | | if let (1, .., 3) = (1, 2, 3) {}
LL | | } else {
| |_____^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:239:15
|
239 | 51 => foo(), //~ ERROR match arms have same body
| ^^^^^
|
--> $DIR/copies.rs:239:15
|
LL | 51 => foo(), //~ ERROR match arms have same body
| ^^^^^
|
note: same as this
--> $DIR/copies.rs:238:15
|
238 | 42 => foo(),
| ^^^^^
--> $DIR/copies.rs:238:15
|
LL | 42 => foo(),
| ^^^^^
note: consider refactoring into `42 | 51`
--> $DIR/copies.rs:238:15
|
238 | 42 => foo(),
| ^^^^^
--> $DIR/copies.rs:238:15
|
LL | 42 => foo(),
| ^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:245:17
|
245 | None => 24, //~ ERROR match arms have same body
| ^^
|
--> $DIR/copies.rs:245:17
|
LL | None => 24, //~ ERROR match arms have same body
| ^^
|
note: same as this
--> $DIR/copies.rs:244:20
|
244 | Some(_) => 24,
| ^^
--> $DIR/copies.rs:244:20
|
LL | Some(_) => 24,
| ^^
note: consider refactoring into `Some(_) | None`
--> $DIR/copies.rs:244:20
|
244 | Some(_) => 24,
| ^^
--> $DIR/copies.rs:244:20
|
LL | Some(_) => 24,
| ^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:267:28
|
267 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^
|
--> $DIR/copies.rs:267:28
|
LL | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:266:28
|
266 | (Some(a), None) => bar(a),
| ^^^^^^
--> $DIR/copies.rs:266:28
|
LL | (Some(a), None) => bar(a),
| ^^^^^^
note: consider refactoring into `(Some(a), None) | (None, Some(a))`
--> $DIR/copies.rs:266:28
|
266 | (Some(a), None) => bar(a),
| ^^^^^^
--> $DIR/copies.rs:266:28
|
LL | (Some(a), None) => bar(a),
| ^^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:273:26
|
273 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^
|
--> $DIR/copies.rs:273:26
|
LL | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:272:26
|
272 | (Some(a), ..) => bar(a),
| ^^^^^^
--> $DIR/copies.rs:272:26
|
LL | (Some(a), ..) => bar(a),
| ^^^^^^
note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
--> $DIR/copies.rs:272:26
|
272 | (Some(a), ..) => bar(a),
| ^^^^^^
--> $DIR/copies.rs:272:26
|
LL | (Some(a), ..) => bar(a),
| ^^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:279:20
|
279 | (.., 3) => 42, //~ ERROR match arms have same body
| ^^
|
--> $DIR/copies.rs:279:20
|
LL | (.., 3) => 42, //~ ERROR match arms have same body
| ^^
|
note: same as this
--> $DIR/copies.rs:278:23
|
278 | (1, .., 3) => 42,
| ^^
--> $DIR/copies.rs:278:23
|
LL | (1, .., 3) => 42,
| ^^
note: consider refactoring into `(1, .., 3) | (.., 3)`
--> $DIR/copies.rs:278:23
|
278 | (1, .., 3) => 42,
| ^^
--> $DIR/copies.rs:278:23
|
LL | (1, .., 3) => 42,
| ^^
error: this `if` has identical blocks
--> $DIR/copies.rs:285:12
|
285 | } else {
| ____________^
286 | | //~ ERROR same body as `if` block
287 | | 0.0
288 | | };
| |_____^
|
--> $DIR/copies.rs:285:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | 0.0
LL | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:283:21
|
283 | let _ = if true {
| _____________________^
284 | | 0.0
285 | | } else {
| |_____^
--> $DIR/copies.rs:283:21
|
LL | let _ = if true {
| _____________________^
LL | | 0.0
LL | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:292:12
|
292 | } else {
| ____________^
293 | | //~ ERROR same body as `if` block
294 | | -0.0
295 | | };
| |_____^
|
--> $DIR/copies.rs:292:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | -0.0
LL | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:290:21
|
290 | let _ = if true {
| _____________________^
291 | | -0.0
292 | | } else {
| |_____^
--> $DIR/copies.rs:290:21
|
LL | let _ = if true {
| _____________________^
LL | | -0.0
LL | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:305:12
|
305 | } else {
| ____________^
306 | | //~ ERROR same body as `if` block
307 | | std::f32::NAN
308 | | };
| |_____^
|
--> $DIR/copies.rs:305:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | std::f32::NAN
LL | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:303:21
|
303 | let _ = if true {
| _____________________^
304 | | std::f32::NAN
305 | | } else {
| |_____^
--> $DIR/copies.rs:303:21
|
LL | let _ = if true {
| _____________________^
LL | | std::f32::NAN
LL | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:323:12
|
323 | } else {
| ____________^
324 | | //~ ERROR same body as `if` block
325 | | try!(Ok("foo"));
326 | | }
| |_____^
|
--> $DIR/copies.rs:323:12
|
LL | } else {
| ____________^
LL | | //~ ERROR same body as `if` block
LL | | try!(Ok("foo"));
LL | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:321:13
|
321 | if true {
| _____________^
322 | | try!(Ok("foo"));
323 | | } else {
| |_____^
--> $DIR/copies.rs:321:13
|
LL | if true {
| _____________^
LL | | try!(Ok("foo"));
LL | | } else {
| |_____^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:347:15
|
347 | } else if b {
| ^
|
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
--> $DIR/copies.rs:347:15
|
LL | } else if b {
| ^
|
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
note: same as this
--> $DIR/copies.rs:346:8
|
346 | if b {
| ^
--> $DIR/copies.rs:346:8
|
LL | if b {
| ^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:352:15
|
352 | } else if a == 1 {
| ^^^^^^
|
--> $DIR/copies.rs:352:15
|
LL | } else if a == 1 {
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:351:8
|
351 | if a == 1 {
| ^^^^^^
--> $DIR/copies.rs:351:8
|
LL | if a == 1 {
| ^^^^^^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:358:15
|
358 | } else if 2 * a == 1 {
| ^^^^^^^^^^
|
--> $DIR/copies.rs:358:15
|
LL | } else if 2 * a == 1 {
| ^^^^^^^^^^
|
note: same as this
--> $DIR/copies.rs:356:8
|
356 | if 2 * a == 1 {
| ^^^^^^^^^^
--> $DIR/copies.rs:356:8
|
LL | if 2 * a == 1 {
| ^^^^^^^^^^
error: aborting due to 20 previous errors

View file

@ -1,13 +1,13 @@
error: you are implementing `Iterator` on a `Copy` type
--> $DIR/copy_iterator.rs:15:1
|
15 | / impl Iterator for Countdown {
16 | | type Item = u8;
17 | |
18 | | fn next(&mut self) -> Option<u8> {
LL | / impl Iterator for Countdown {
LL | | type Item = u8;
LL | |
LL | | fn next(&mut self) -> Option<u8> {
... |
23 | | }
24 | | }
LL | | }
LL | | }
| |_^
|
= note: `-D clippy::copy-iterator` implied by `-D warnings`

View file

@ -1,7 +1,7 @@
error: you are getting the inner pointer of a temporary `CString`
--> $DIR/cstring.rs:16:5
|
16 | CString::new("foo").unwrap().as_ptr();
LL | CString::new("foo").unwrap().as_ptr();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[deny(clippy::temporary_cstring_as_ptr)] on by default
@ -9,7 +9,7 @@ error: you are getting the inner pointer of a temporary `CString`
help: assign the `CString` to a variable to extend its lifetime
--> $DIR/cstring.rs:16:5
|
16 | CString::new("foo").unwrap().as_ptr();
LL | CString::new("foo").unwrap().as_ptr();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,272 +1,272 @@
error: the function has a cyclomatic complexity of 28
--> $DIR/cyclomatic_complexity.rs:15:1
|
15 | / fn main() {
16 | | if true {
17 | | println!("a");
18 | | }
LL | / fn main() {
LL | | if true {
LL | | println!("a");
LL | | }
... |
96 | | }
97 | | }
LL | | }
LL | | }
| |_^
|
= note: `-D clippy::cyclomatic-complexity` implied by `-D warnings`
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 7
--> $DIR/cyclomatic_complexity.rs:100:1
|
100 | / fn kaboom() {
101 | | let n = 0;
102 | | 'a: for i in 0..20 {
103 | | 'b: for j in i..20 {
... |
118 | | }
119 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:100:1
|
LL | / fn kaboom() {
LL | | let n = 0;
LL | | 'a: for i in 0..20 {
LL | | 'b: for j in i..20 {
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:146:1
|
146 | / fn lots_of_short_circuits() -> bool {
147 | | true && false && true && false && true && false && true
148 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:146:1
|
LL | / fn lots_of_short_circuits() -> bool {
LL | | true && false && true && false && true && false && true
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:151:1
|
151 | / fn lots_of_short_circuits2() -> bool {
152 | | true || false || true || false || true || false || true
153 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:151:1
|
LL | / fn lots_of_short_circuits2() -> bool {
LL | | true || false || true || false || true || false || true
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:156:1
|
156 | / fn baa() {
157 | | let x = || match 99 {
158 | | 0 => 0,
159 | | 1 => 1,
... |
170 | | }
171 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:156:1
|
LL | / fn baa() {
LL | | let x = || match 99 {
LL | | 0 => 0,
LL | | 1 => 1,
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:157:13
|
157 | let x = || match 99 {
| _____________^
158 | | 0 => 0,
159 | | 1 => 1,
160 | | 2 => 2,
... |
164 | | _ => 42,
165 | | };
| |_____^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:157:13
|
LL | let x = || match 99 {
| _____________^
LL | | 0 => 0,
LL | | 1 => 1,
LL | | 2 => 2,
... |
LL | | _ => 42,
LL | | };
| |_____^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:174:1
|
174 | / fn bar() {
175 | | match 99 {
176 | | 0 => println!("hi"),
177 | | _ => println!("bye"),
178 | | }
179 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:174:1
|
LL | / fn bar() {
LL | | match 99 {
LL | | 0 => println!("hi"),
LL | | _ => println!("bye"),
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:193:1
|
193 | / fn barr() {
194 | | match 99 {
195 | | 0 => println!("hi"),
196 | | 1 => println!("bla"),
... |
199 | | }
200 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:193:1
|
LL | / fn barr() {
LL | | match 99 {
LL | | 0 => println!("hi"),
LL | | 1 => println!("bla"),
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity.rs:203:1
|
203 | / fn barr2() {
204 | | match 99 {
205 | | 0 => println!("hi"),
206 | | 1 => println!("bla"),
... |
215 | | }
216 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:203:1
|
LL | / fn barr2() {
LL | | match 99 {
LL | | 0 => println!("hi"),
LL | | 1 => println!("bla"),
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:219:1
|
219 | / fn barrr() {
220 | | match 99 {
221 | | 0 => println!("hi"),
222 | | 1 => panic!("bla"),
... |
225 | | }
226 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:219:1
|
LL | / fn barrr() {
LL | | match 99 {
LL | | 0 => println!("hi"),
LL | | 1 => panic!("bla"),
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity.rs:229:1
|
229 | / fn barrr2() {
230 | | match 99 {
231 | | 0 => println!("hi"),
232 | | 1 => panic!("bla"),
... |
241 | | }
242 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:229:1
|
LL | / fn barrr2() {
LL | | match 99 {
LL | | 0 => println!("hi"),
LL | | 1 => panic!("bla"),
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:245:1
|
245 | / fn barrrr() {
246 | | match 99 {
247 | | 0 => println!("hi"),
248 | | 1 => println!("bla"),
... |
251 | | }
252 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:245:1
|
LL | / fn barrrr() {
LL | | match 99 {
LL | | 0 => println!("hi"),
LL | | 1 => println!("bla"),
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity.rs:255:1
|
255 | / fn barrrr2() {
256 | | match 99 {
257 | | 0 => println!("hi"),
258 | | 1 => println!("bla"),
... |
267 | | }
268 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:255:1
|
LL | / fn barrrr2() {
LL | | match 99 {
LL | | 0 => println!("hi"),
LL | | 1 => println!("bla"),
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 2
--> $DIR/cyclomatic_complexity.rs:271:1
|
271 | / fn cake() {
272 | | if 4 == 5 {
273 | | println!("yea");
274 | | } else {
... |
277 | | println!("whee");
278 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:271:1
|
LL | / fn cake() {
LL | | if 4 == 5 {
LL | | println!("yea");
LL | | } else {
... |
LL | | println!("whee");
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 4
--> $DIR/cyclomatic_complexity.rs:281:1
|
281 | / pub fn read_file(input_path: &str) -> String {
282 | | use std::fs::File;
283 | | use std::io::{Read, Write};
284 | | use std::path::Path;
... |
306 | | }
307 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:281:1
|
LL | / pub fn read_file(input_path: &str) -> String {
LL | | use std::fs::File;
LL | | use std::io::{Read, Write};
LL | | use std::path::Path;
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:312:1
|
312 | / fn void(void: Void) {
313 | | if true {
314 | | match void {}
315 | | }
316 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:312:1
|
LL | / fn void(void: Void) {
LL | | if true {
LL | | match void {}
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:325:1
|
325 | / fn try() -> Result<i32, &'static str> {
326 | | match 5 {
327 | | 5 => Ok(5),
328 | | _ => return Err("bla"),
329 | | }
330 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:325:1
|
LL | / fn try() -> Result<i32, &'static str> {
LL | | match 5 {
LL | | 5 => Ok(5),
LL | | _ => return Err("bla"),
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:333:1
|
333 | / fn try_again() -> Result<i32, &'static str> {
334 | | let _ = try!(Ok(42));
335 | | let _ = try!(Ok(43));
336 | | let _ = try!(Ok(44));
... |
345 | | }
346 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:333:1
|
LL | / fn try_again() -> Result<i32, &'static str> {
LL | | let _ = try!(Ok(42));
LL | | let _ = try!(Ok(43));
LL | | let _ = try!(Ok(44));
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 1
--> $DIR/cyclomatic_complexity.rs:349:1
|
349 | / fn early() -> Result<i32, &'static str> {
350 | | return Ok(5);
351 | | return Ok(5);
352 | | return Ok(5);
... |
358 | | return Ok(5);
359 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:349:1
|
LL | / fn early() -> Result<i32, &'static str> {
LL | | return Ok(5);
LL | | return Ok(5);
LL | | return Ok(5);
... |
LL | | return Ok(5);
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: the function has a cyclomatic complexity of 8
--> $DIR/cyclomatic_complexity.rs:363:1
|
363 | / fn early_ret() -> i32 {
364 | | let a = if true { 42 } else { return 0; };
365 | | let a = if a < 99 { 42 } else { return 0; };
366 | | let a = if a < 99 { 42 } else { return 0; };
... |
379 | | }
380 | | }
| |_^
|
= help: you could split it up into multiple smaller functions
--> $DIR/cyclomatic_complexity.rs:363:1
|
LL | / fn early_ret() -> i32 {
LL | | let a = if true { 42 } else { return 0; };
LL | | let a = if a < 99 { 42 } else { return 0; };
LL | | let a = if a < 99 { 42 } else { return 0; };
... |
LL | | }
LL | | }
| |_^
|
= help: you could split it up into multiple smaller functions
error: aborting due to 20 previous errors

View file

@ -1,13 +1,13 @@
error: the function has a cyclomatic complexity of 3
--> $DIR/cyclomatic_complexity_attr_used.rs:18:1
|
18 | / fn kaboom() {
19 | | if 42 == 43 {
20 | | panic!();
21 | | } else if "cake" == "lie" {
22 | | println!("what?");
23 | | }
24 | | }
LL | / fn kaboom() {
LL | | if 42 == 43 {
LL | | panic!();
LL | | } else if "cake" == "lie" {
LL | | println!("what?");
LL | | }
LL | | }
| |_^
|
= note: `-D clippy::cyclomatic-complexity` implied by `-D warnings`

View file

@ -1,7 +1,7 @@
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:25:9
|
25 | 32_773, // 0x8005
LL | 32_773, // 0x8005
| ^^^^^^ help: consider: `0x8005`
|
= note: `-D clippy::decimal-literal-representation` implied by `-D warnings`
@ -9,25 +9,25 @@ error: integer literal has a better hexadecimal representation
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:26:9
|
26 | 65_280, // 0xFF00
LL | 65_280, // 0xFF00
| ^^^^^^ help: consider: `0xFF00`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:27:9
|
27 | 2_131_750_927, // 0x7F0F_F00F
LL | 2_131_750_927, // 0x7F0F_F00F
| ^^^^^^^^^^^^^ help: consider: `0x7F0F_F00F`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:28:9
|
28 | 2_147_483_647, // 0x7FFF_FFFF
LL | 2_147_483_647, // 0x7FFF_FFFF
| ^^^^^^^^^^^^^ help: consider: `0x7FFF_FFFF`
error: integer literal has a better hexadecimal representation
--> $DIR/decimal_literal_representation.rs:29:9
|
29 | 4_042_322_160, // 0xF0F0_F0F0
LL | 4_042_322_160, // 0xF0F0_F0F0
| ^^^^^^^^^^^^^ help: consider: `0xF0F0_F0F0`
error: aborting due to 5 previous errors

View file

@ -1,7 +1,7 @@
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:17:22
|
17 | let s1: String = Default::default();
LL | let s1: String = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
|
= note: `-D clippy::default-trait-access` implied by `-D warnings`
@ -9,43 +9,43 @@ error: Calling std::string::String::default() is more clear than this expression
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:21:22
|
21 | let s3: String = D2::default();
LL | let s3: String = D2::default();
| ^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:23:22
|
23 | let s4: String = std::default::Default::default();
LL | let s4: String = std::default::Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling std::string::String::default() is more clear than this expression
--> $DIR/default_trait_access.rs:27:22
|
27 | let s6: String = default::Default::default();
LL | let s6: String = default::Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling GenericDerivedDefault<std::string::String>::default() is more clear than this expression
--> $DIR/default_trait_access.rs:37:46
|
37 | let s11: GenericDerivedDefault<String> = Default::default();
LL | let s11: GenericDerivedDefault<String> = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault<std::string::String>::default()`
error: Calling TupleDerivedDefault::default() is more clear than this expression
--> $DIR/default_trait_access.rs:43:36
|
43 | let s14: TupleDerivedDefault = Default::default();
LL | let s14: TupleDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()`
error: Calling ArrayDerivedDefault::default() is more clear than this expression
--> $DIR/default_trait_access.rs:45:36
|
45 | let s15: ArrayDerivedDefault = Default::default();
LL | let s15: ArrayDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()`
error: Calling TupleStructDerivedDefault::default() is more clear than this expression
--> $DIR/default_trait_access.rs:49:42
|
49 | let s17: TupleStructDerivedDefault = Default::default();
LL | let s17: TupleStructDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `TupleStructDerivedDefault::default()`
error: aborting due to 8 previous errors

View file

@ -1,7 +1,7 @@
error: lint `str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
--> $DIR/deprecated.rs:10:8
|
10 | #[warn(str_to_string)]
LL | #[warn(str_to_string)]
| ^^^^^^^^^^^^^
|
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
@ -9,25 +9,25 @@ error: lint `str_to_string` has been removed: `using `str::to_string` is common
error: lint `string_to_string` has been removed: `using `string::to_string` is common even today and specialization will likely happen soon`
--> $DIR/deprecated.rs:11:8
|
11 | #[warn(string_to_string)]
LL | #[warn(string_to_string)]
| ^^^^^^^^^^^^^^^^
error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
--> $DIR/deprecated.rs:12:8
|
12 | #[warn(unstable_as_slice)]
LL | #[warn(unstable_as_slice)]
| ^^^^^^^^^^^^^^^^^
error: lint `unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7`
--> $DIR/deprecated.rs:13:8
|
13 | #[warn(unstable_as_mut_slice)]
LL | #[warn(unstable_as_mut_slice)]
| ^^^^^^^^^^^^^^^^^^^^^
error: lint `misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr`
--> $DIR/deprecated.rs:14:8
|
14 | #[warn(misaligned_transmute)]
LL | #[warn(misaligned_transmute)]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 5 previous errors

View file

@ -1,130 +1,130 @@
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
--> $DIR/derive.rs:25:10
|
25 | #[derive(Hash)]
LL | #[derive(Hash)]
| ^^^^
|
= note: #[deny(clippy::derive_hash_xor_eq)] on by default
note: `PartialEq` implemented here
--> $DIR/derive.rs:28:1
|
28 | / impl PartialEq for Bar {
29 | | fn eq(&self, _: &Bar) -> bool {
30 | | true
31 | | }
32 | | }
LL | / impl PartialEq for Bar {
LL | | fn eq(&self, _: &Bar) -> bool {
LL | | true
LL | | }
LL | | }
| |_^
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
--> $DIR/derive.rs:34:10
|
34 | #[derive(Hash)]
LL | #[derive(Hash)]
| ^^^^
|
note: `PartialEq` implemented here
--> $DIR/derive.rs:37:1
|
37 | / impl PartialEq<Baz> for Baz {
38 | | fn eq(&self, _: &Baz) -> bool {
39 | | true
40 | | }
41 | | }
LL | / impl PartialEq<Baz> for Baz {
LL | | fn eq(&self, _: &Baz) -> bool {
LL | | true
LL | | }
LL | | }
| |_^
error: you are implementing `Hash` explicitly but have derived `PartialEq`
--> $DIR/derive.rs:46:1
|
46 | / impl Hash for Bah {
47 | | fn hash<H: Hasher>(&self, _: &mut H) {}
48 | | }
LL | / impl Hash for Bah {
LL | | fn hash<H: Hasher>(&self, _: &mut H) {}
LL | | }
| |_^
|
note: `PartialEq` implemented here
--> $DIR/derive.rs:43:10
|
43 | #[derive(PartialEq)]
LL | #[derive(PartialEq)]
| ^^^^^^^^^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:53:1
|
53 | / impl Clone for Qux {
54 | | fn clone(&self) -> Self {
55 | | Qux
56 | | }
57 | | }
LL | / impl Clone for Qux {
LL | | fn clone(&self) -> Self {
LL | | Qux
LL | | }
LL | | }
| |_^
|
= note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings`
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:53:1
|
53 | / impl Clone for Qux {
54 | | fn clone(&self) -> Self {
55 | | Qux
56 | | }
57 | | }
LL | / impl Clone for Qux {
LL | | fn clone(&self) -> Self {
LL | | Qux
LL | | }
LL | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:77:1
|
77 | / impl<'a> Clone for Lt<'a> {
78 | | fn clone(&self) -> Self {
79 | | unimplemented!()
80 | | }
81 | | }
LL | / impl<'a> Clone for Lt<'a> {
LL | | fn clone(&self) -> Self {
LL | | unimplemented!()
LL | | }
LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:77:1
|
77 | / impl<'a> Clone for Lt<'a> {
78 | | fn clone(&self) -> Self {
79 | | unimplemented!()
80 | | }
81 | | }
LL | / impl<'a> Clone for Lt<'a> {
LL | | fn clone(&self) -> Self {
LL | | unimplemented!()
LL | | }
LL | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:89:1
|
89 | / impl Clone for BigArray {
90 | | fn clone(&self) -> Self {
91 | | unimplemented!()
92 | | }
93 | | }
LL | / impl Clone for BigArray {
LL | | fn clone(&self) -> Self {
LL | | unimplemented!()
LL | | }
LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:89:1
|
89 | / impl Clone for BigArray {
90 | | fn clone(&self) -> Self {
91 | | unimplemented!()
92 | | }
93 | | }
LL | / impl Clone for BigArray {
LL | | fn clone(&self) -> Self {
LL | | unimplemented!()
LL | | }
LL | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:101:1
|
101 | / impl Clone for FnPtr {
102 | | fn clone(&self) -> Self {
103 | | unimplemented!()
104 | | }
105 | | }
| |_^
|
--> $DIR/derive.rs:101:1
|
LL | / impl Clone for FnPtr {
LL | | fn clone(&self) -> Self {
LL | | unimplemented!()
LL | | }
LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:101:1
|
101 | / impl Clone for FnPtr {
102 | | fn clone(&self) -> Self {
103 | | unimplemented!()
104 | | }
105 | | }
| |_^
--> $DIR/derive.rs:101:1
|
LL | / impl Clone for FnPtr {
LL | | fn clone(&self) -> Self {
LL | | unimplemented!()
LL | | }
LL | | }
| |_^
error: aborting due to 7 previous errors

View file

@ -1,7 +1,7 @@
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:30:10
|
30 | b || diverge();
LL | b || diverge();
| ^^^^^^^^^
|
= note: `-D clippy::diverging-sub-expression` implied by `-D warnings`
@ -9,31 +9,31 @@ error: sub-expression diverges
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:31:10
|
31 | b || A.foo();
LL | b || A.foo();
| ^^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:40:26
|
40 | 6 => true || return,
LL | 6 => true || return,
| ^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:41:26
|
41 | 7 => true || continue,
LL | 7 => true || continue,
| ^^^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:44:26
|
44 | 3 => true || diverge(),
LL | 3 => true || diverge(),
| ^^^^^^^^^
error: sub-expression diverges
--> $DIR/diverging_sub_expression.rs:49:26
|
49 | _ => true || break,
LL | _ => true || break,
| ^^^^^
error: aborting due to 6 previous errors

View file

@ -1,7 +1,7 @@
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:19:16
|
19 | type Baz = LinkedList<u8>;
LL | type Baz = LinkedList<u8>;
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::linkedlist` implied by `-D warnings`
@ -10,7 +10,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:20:12
|
20 | fn foo(LinkedList<u8>);
LL | fn foo(LinkedList<u8>);
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
@ -18,7 +18,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:21:23
|
21 | const BAR: Option<LinkedList<u8>>;
LL | const BAR: Option<LinkedList<u8>>;
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
@ -26,7 +26,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:32:15
|
32 | fn foo(_: LinkedList<u8>) {}
LL | fn foo(_: LinkedList<u8>) {}
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
@ -34,7 +34,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:35:39
|
35 | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
LL | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work
@ -42,7 +42,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:39:29
|
39 | pub fn test_ret() -> Option<LinkedList<u8>> {
LL | pub fn test_ret() -> Option<LinkedList<u8>> {
| ^^^^^^^^^^^^^^
|
= help: a VecDeque might work

View file

@ -1,7 +1,7 @@
error: you should put `DOC_MARKDOWN` between ticks in the documentation
--> $DIR/doc.rs:10:29
|
10 | //! This file tests for the DOC_MARKDOWN lint
LL | //! This file tests for the DOC_MARKDOWN lint
| ^^^^^^^^^^^^
|
= note: `-D clippy::doc-markdown` implied by `-D warnings`
@ -9,182 +9,182 @@ error: you should put `DOC_MARKDOWN` between ticks in the documentation
error: you should put `foo_bar` between ticks in the documentation
--> $DIR/doc.rs:15:9
|
15 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
| ^^^^^^^
error: you should put `foo::bar` between ticks in the documentation
--> $DIR/doc.rs:15:51
|
15 | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
| ^^^^^^^^
error: you should put `Foo::some_fun` between ticks in the documentation
--> $DIR/doc.rs:16:84
|
16 | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun
LL | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun
| ^^^^^^^^^^^^^
error: you should put `a::global:path` between ticks in the documentation
--> $DIR/doc.rs:18:15
|
18 | /// Here be ::a::global:path.
LL | /// Here be ::a::global:path.
| ^^^^^^^^^^^^^^
error: you should put `NotInCodeBlock` between ticks in the documentation
--> $DIR/doc.rs:19:22
|
19 | /// That's not code ~NotInCodeBlock~.
LL | /// That's not code ~NotInCodeBlock~.
| ^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:20:5
|
20 | /// be_sure_we_got_to_the_end_of_it
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:34:5
|
34 | /// be_sure_we_got_to_the_end_of_it
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:41:5
|
41 | /// be_sure_we_got_to_the_end_of_it
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:55:5
|
55 | /// be_sure_we_got_to_the_end_of_it
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `link_with_underscores` between ticks in the documentation
--> $DIR/doc.rs:59:22
|
59 | /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
LL | /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
| ^^^^^^^^^^^^^^^^^^^^^
error: you should put `inline_link2` between ticks in the documentation
--> $DIR/doc.rs:62:21
|
62 | /// It can also be [inline_link2].
LL | /// It can also be [inline_link2].
| ^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:72:5
|
72 | /// be_sure_we_got_to_the_end_of_it
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `CamelCaseThing` between ticks in the documentation
--> $DIR/doc.rs:80:8
|
80 | /// ## CamelCaseThing
LL | /// ## CamelCaseThing
| ^^^^^^^^^^^^^^
error: you should put `CamelCaseThing` between ticks in the documentation
--> $DIR/doc.rs:83:7
|
83 | /// # CamelCaseThing
LL | /// # CamelCaseThing
| ^^^^^^^^^^^^^^
error: you should put `CamelCaseThing` between ticks in the documentation
--> $DIR/doc.rs:85:22
|
85 | /// Not a title #897 CamelCaseThing
LL | /// Not a title #897 CamelCaseThing
| ^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:86:5
|
86 | /// be_sure_we_got_to_the_end_of_it
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:93:5
|
93 | /// be_sure_we_got_to_the_end_of_it
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:106:5
|
106 | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:106:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `FooBar` between ticks in the documentation
--> $DIR/doc.rs:117:42
|
117 | /** E.g. serialization of an empty list: FooBar
| ^^^^^^
--> $DIR/doc.rs:117:42
|
LL | /** E.g. serialization of an empty list: FooBar
| ^^^^^^
error: you should put `BarQuz` between ticks in the documentation
--> $DIR/doc.rs:122:5
|
122 | And BarQuz too.
| ^^^^^^
--> $DIR/doc.rs:122:5
|
LL | And BarQuz too.
| ^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:123:1
|
123 | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:123:1
|
LL | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `FooBar` between ticks in the documentation
--> $DIR/doc.rs:128:42
|
128 | /** E.g. serialization of an empty list: FooBar
| ^^^^^^
--> $DIR/doc.rs:128:42
|
LL | /** E.g. serialization of an empty list: FooBar
| ^^^^^^
error: you should put `BarQuz` between ticks in the documentation
--> $DIR/doc.rs:133:5
|
133 | And BarQuz too.
| ^^^^^^
--> $DIR/doc.rs:133:5
|
LL | And BarQuz too.
| ^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:134:1
|
134 | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:134:1
|
LL | be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
--> $DIR/doc.rs:145:5
|
145 | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:145:5
|
LL | /// be_sure_we_got_to_the_end_of_it
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:172:13
|
172 | /// Not ok: http://www.unicode.org
| ^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:172:13
|
LL | /// Not ok: http://www.unicode.org
| ^^^^^^^^^^^^^^^^^^^^^^
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:173:13
|
173 | /// Not ok: https://www.unicode.org
| ^^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:173:13
|
LL | /// Not ok: https://www.unicode.org
| ^^^^^^^^^^^^^^^^^^^^^^^
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:174:13
|
174 | /// Not ok: http://www.unicode.org/
| ^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:174:13
|
LL | /// Not ok: http://www.unicode.org/
| ^^^^^^^^^^^^^^^^^^^^^^
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> $DIR/doc.rs:175:13
|
175 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:175:13
|
LL | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: you should put `mycrate::Collection` between ticks in the documentation
--> $DIR/doc.rs:181:22
|
181 | /// An iterator over mycrate::Collection's values.
| ^^^^^^^^^^^^^^^^^^^
--> $DIR/doc.rs:181:22
|
LL | /// An iterator over mycrate::Collection's values.
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 31 previous errors

View file

@ -1,7 +1,7 @@
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:13:8
|
13 | if x == y || x < y {
LL | if x == y || x < y {
| ^^^^^^^^^^^^^^^ help: try: `x <= y`
|
= note: `-D clippy::double-comparisons` implied by `-D warnings`
@ -9,43 +9,43 @@ error: This binary expression can be simplified
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:16:8
|
16 | if x < y || x == y {
LL | if x < y || x == y {
| ^^^^^^^^^^^^^^^ help: try: `x <= y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:19:8
|
19 | if x == y || x > y {
LL | if x == y || x > y {
| ^^^^^^^^^^^^^^^ help: try: `x >= y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:22:8
|
22 | if x > y || x == y {
LL | if x > y || x == y {
| ^^^^^^^^^^^^^^^ help: try: `x >= y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:25:8
|
25 | if x < y || x > y {
LL | if x < y || x > y {
| ^^^^^^^^^^^^^^ help: try: `x != y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:28:8
|
28 | if x > y || x < y {
LL | if x > y || x < y {
| ^^^^^^^^^^^^^^ help: try: `x != y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:31:8
|
31 | if x <= y && x >= y {
LL | if x <= y && x >= y {
| ^^^^^^^^^^^^^^^^ help: try: `x == y`
error: This binary expression can be simplified
--> $DIR/double_comparison.rs:34:8
|
34 | if x >= y && x <= y {
LL | if x >= y && x <= y {
| ^^^^^^^^^^^^^^^^ help: try: `x == y`
error: aborting due to 8 previous errors

View file

@ -1,7 +1,7 @@
error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op
--> $DIR/double_neg.rs:15:5
|
15 | --x;
LL | --x;
| ^^^
|
= note: `-D clippy::double-neg` implied by `-D warnings`

View file

@ -1,7 +1,7 @@
error: Consider removing unnecessary double parentheses
--> $DIR/double_parens.rs:21:5
|
21 | ((0))
LL | ((0))
| ^^^^^
|
= note: `-D clippy::double-parens` implied by `-D warnings`
@ -9,31 +9,31 @@ error: Consider removing unnecessary double parentheses
error: Consider removing unnecessary double parentheses
--> $DIR/double_parens.rs:25:14
|
25 | dummy_fn((0));
LL | dummy_fn((0));
| ^^^
error: Consider removing unnecessary double parentheses
--> $DIR/double_parens.rs:29:20
|
29 | x.dummy_method((0));
LL | x.dummy_method((0));
| ^^^
error: Consider removing unnecessary double parentheses
--> $DIR/double_parens.rs:33:5
|
33 | ((1, 2))
LL | ((1, 2))
| ^^^^^^^^
error: Consider removing unnecessary double parentheses
--> $DIR/double_parens.rs:37:5
|
37 | (())
LL | (())
| ^^^^
error: Consider removing unnecessary double parentheses
--> $DIR/double_parens.rs:59:16
|
59 | assert_eq!(((1, 2)), (1, 2), "Error");
LL | assert_eq!(((1, 2)), (1, 2), "Error");
| ^^^^^^^^
error: aborting due to 6 previous errors

View file

@ -1,75 +1,75 @@
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:42:5
|
42 | drop(s1);
LL | drop(s1);
| ^^^^^^^^
|
= note: `-D clippy::drop-copy` implied by `-D warnings`
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:42:10
|
42 | drop(s1);
LL | drop(s1);
| ^^
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:43:5
|
43 | drop(s2);
LL | drop(s2);
| ^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:43:10
|
43 | drop(s2);
LL | drop(s2);
| ^^
error: calls to `std::mem::drop` with a value that implements Copy. Dropping a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:45:5
|
45 | drop(s4);
LL | drop(s4);
| ^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:45:10
|
45 | drop(s4);
LL | drop(s4);
| ^^
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:48:5
|
48 | forget(s1);
LL | forget(s1);
| ^^^^^^^^^^
|
= note: `-D clippy::forget-copy` implied by `-D warnings`
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:48:12
|
48 | forget(s1);
LL | forget(s1);
| ^^
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:49:5
|
49 | forget(s2);
LL | forget(s2);
| ^^^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:49:12
|
49 | forget(s2);
LL | forget(s2);
| ^^
error: calls to `std::mem::forget` with a value that implements Copy. Forgetting a copy leaves the original intact.
--> $DIR/drop_forget_copy.rs:51:5
|
51 | forget(s4);
LL | forget(s4);
| ^^^^^^^^^^
|
note: argument has type SomeStruct
--> $DIR/drop_forget_copy.rs:51:12
|
51 | forget(s4);
LL | forget(s4);
| ^^
error: aborting due to 6 previous errors

View file

@ -1,219 +1,219 @@
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:18:5
|
18 | drop(&SomeStruct);
LL | drop(&SomeStruct);
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::drop-ref` implied by `-D warnings`
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:18:10
|
18 | drop(&SomeStruct);
LL | drop(&SomeStruct);
| ^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:19:5
|
19 | forget(&SomeStruct);
LL | forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::forget-ref` implied by `-D warnings`
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:19:12
|
19 | forget(&SomeStruct);
LL | forget(&SomeStruct);
| ^^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:22:5
|
22 | drop(&owned1);
LL | drop(&owned1);
| ^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:22:10
|
22 | drop(&owned1);
LL | drop(&owned1);
| ^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:23:5
|
23 | drop(&&owned1);
LL | drop(&&owned1);
| ^^^^^^^^^^^^^^
|
note: argument has type &&SomeStruct
--> $DIR/drop_forget_ref.rs:23:10
|
23 | drop(&&owned1);
LL | drop(&&owned1);
| ^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:24:5
|
24 | drop(&mut owned1);
LL | drop(&mut owned1);
| ^^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:24:10
|
24 | drop(&mut owned1);
LL | drop(&mut owned1);
| ^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:27:5
|
27 | forget(&owned2);
LL | forget(&owned2);
| ^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:27:12
|
27 | forget(&owned2);
LL | forget(&owned2);
| ^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:28:5
|
28 | forget(&&owned2);
LL | forget(&&owned2);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &&SomeStruct
--> $DIR/drop_forget_ref.rs:28:12
|
28 | forget(&&owned2);
LL | forget(&&owned2);
| ^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:29:5
|
29 | forget(&mut owned2);
LL | forget(&mut owned2);
| ^^^^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:29:12
|
29 | forget(&mut owned2);
LL | forget(&mut owned2);
| ^^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:33:5
|
33 | drop(reference1);
LL | drop(reference1);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:33:10
|
33 | drop(reference1);
LL | drop(reference1);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:34:5
|
34 | forget(&*reference1);
LL | forget(&*reference1);
| ^^^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:34:12
|
34 | forget(&*reference1);
LL | forget(&*reference1);
| ^^^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:37:5
|
37 | drop(reference2);
LL | drop(reference2);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:37:10
|
37 | drop(reference2);
LL | drop(reference2);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:39:5
|
39 | forget(reference3);
LL | forget(reference3);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type &mut SomeStruct
--> $DIR/drop_forget_ref.rs:39:12
|
39 | forget(reference3);
LL | forget(reference3);
| ^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:42:5
|
42 | drop(reference4);
LL | drop(reference4);
| ^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:42:10
|
42 | drop(reference4);
LL | drop(reference4);
| ^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:43:5
|
43 | forget(reference4);
LL | forget(reference4);
| ^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:43:12
|
43 | forget(reference4);
LL | forget(reference4);
| ^^^^^^^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:48:5
|
48 | drop(&val);
LL | drop(&val);
| ^^^^^^^^^^
|
note: argument has type &T
--> $DIR/drop_forget_ref.rs:48:10
|
48 | drop(&val);
LL | drop(&val);
| ^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:54:5
|
54 | forget(&val);
LL | forget(&val);
| ^^^^^^^^^^^^
|
note: argument has type &T
--> $DIR/drop_forget_ref.rs:54:12
|
54 | forget(&val);
LL | forget(&val);
| ^^^^
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> $DIR/drop_forget_ref.rs:62:5
|
62 | std::mem::drop(&SomeStruct);
LL | std::mem::drop(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:62:20
|
62 | std::mem::drop(&SomeStruct);
LL | std::mem::drop(&SomeStruct);
| ^^^^^^^^^^^
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
--> $DIR/drop_forget_ref.rs:65:5
|
65 | std::mem::forget(&SomeStruct);
LL | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: argument has type &SomeStruct
--> $DIR/drop_forget_ref.rs:65:22
|
65 | std::mem::forget(&SomeStruct);
LL | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^
error: aborting due to 18 previous errors

View file

@ -1,7 +1,7 @@
error: `darth` already exists, having another argument having almost the same name makes code comprehension and documentation more difficult
--> $DIR/duplicate_underscore_argument.rs:13:23
|
13 | fn join_the_dark_side(darth: i32, _darth: i32) {}
LL | fn join_the_dark_side(darth: i32, _darth: i32) {}
| ^^^^^
|
= note: `-D clippy::duplicate-underscore-argument` implied by `-D warnings`

View file

@ -1,7 +1,7 @@
error: Calling `subsec_millis()` is more concise than this calculation
--> $DIR/duration_subsec.rs:17:24
|
17 | let bad_millis_1 = dur.subsec_micros() / 1_000;
LL | let bad_millis_1 = dur.subsec_micros() / 1_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()`
|
= note: `-D clippy::duration-subsec` implied by `-D warnings`
@ -9,25 +9,25 @@ error: Calling `subsec_millis()` is more concise than this calculation
error: Calling `subsec_millis()` is more concise than this calculation
--> $DIR/duration_subsec.rs:18:24
|
18 | let bad_millis_2 = dur.subsec_nanos() / 1_000_000;
LL | let bad_millis_2 = dur.subsec_nanos() / 1_000_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()`
error: Calling `subsec_micros()` is more concise than this calculation
--> $DIR/duration_subsec.rs:23:22
|
23 | let bad_micros = dur.subsec_nanos() / 1_000;
LL | let bad_micros = dur.subsec_nanos() / 1_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()`
error: Calling `subsec_micros()` is more concise than this calculation
--> $DIR/duration_subsec.rs:28:13
|
28 | let _ = (&dur).subsec_nanos() / 1_000;
LL | let _ = (&dur).subsec_nanos() / 1_000;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&dur).subsec_micros()`
error: Calling `subsec_micros()` is more concise than this calculation
--> $DIR/duration_subsec.rs:32:13
|
32 | let _ = dur.subsec_nanos() / NANOS_IN_MICRO;
LL | let _ = dur.subsec_nanos() / NANOS_IN_MICRO;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()`
error: aborting due to 5 previous errors

View file

@ -1,11 +1,11 @@
error: if expression with an `else if`, but without a final `else`
--> $DIR/else_if_without_else.rs:54:12
|
54 | } else if bla2() {
LL | } else if bla2() {
| ____________^
55 | | //~ ERROR else if without else
56 | | println!("else if");
57 | | }
LL | | //~ ERROR else if without else
LL | | println!("else if");
LL | | }
| |_____^
|
= note: `-D clippy::else-if-without-else` implied by `-D warnings`
@ -14,11 +14,11 @@ error: if expression with an `else if`, but without a final `else`
error: if expression with an `else if`, but without a final `else`
--> $DIR/else_if_without_else.rs:63:12
|
63 | } else if bla3() {
LL | } else if bla3() {
| ____________^
64 | | //~ ERROR else if without else
65 | | println!("else if 2");
66 | | }
LL | | //~ ERROR else if without else
LL | | println!("else if 2");
LL | | }
| |_____^
|
= help: add an `else` block here

View file

@ -1,14 +1,14 @@
error: enum with no variants
--> $DIR/empty_enum.rs:13:1
|
13 | enum Empty {}
LL | enum Empty {}
| ^^^^^^^^^^^^^
|
= note: `-D clippy::empty-enum` implied by `-D warnings`
help: consider using the uninhabited type `!` or a wrapper around it
--> $DIR/empty_enum.rs:13:1
|
13 | enum Empty {}
LL | enum Empty {}
| ^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,10 +1,10 @@
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:13:1
|
13 | / #[crate_type = "lib"]
14 | |
15 | | /// some comment
16 | | fn with_one_newline_and_comment() { assert!(true) }
LL | / #[crate_type = "lib"]
LL | |
LL | | /// some comment
LL | | fn with_one_newline_and_comment() { assert!(true) }
| |_
|
= note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings`
@ -12,42 +12,42 @@ error: Found an empty line after an outer attribute. Perhaps you forgot to add a
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:25:1
|
25 | / #[crate_type = "lib"]
26 | |
27 | | fn with_one_newline() { assert!(true) }
LL | / #[crate_type = "lib"]
LL | |
LL | | fn with_one_newline() { assert!(true) }
| |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:30:1
|
30 | / #[crate_type = "lib"]
31 | |
32 | |
33 | | fn with_two_newlines() { assert!(true) }
LL | / #[crate_type = "lib"]
LL | |
LL | |
LL | | fn with_two_newlines() { assert!(true) }
| |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:37:1
|
37 | / #[crate_type = "lib"]
38 | |
39 | | enum Baz {
LL | / #[crate_type = "lib"]
LL | |
LL | | enum Baz {
| |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:45:1
|
45 | / #[crate_type = "lib"]
46 | |
47 | | struct Foo {
LL | / #[crate_type = "lib"]
LL | |
LL | | struct Foo {
| |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:53:1
|
53 | / #[crate_type = "lib"]
54 | |
55 | | mod foo {
LL | / #[crate_type = "lib"]
LL | |
LL | | mod foo {
| |_
error: aborting due to 6 previous errors

View file

@ -1,9 +1,9 @@
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:19:5
|
19 | / if !m.contains_key(&k) {
20 | | m.insert(k, v);
21 | | }
LL | / if !m.contains_key(&k) {
LL | | m.insert(k, v);
LL | | }
| |_____^ help: consider using: `m.entry(k).or_insert(v)`
|
= note: `-D clippy::map-entry` implied by `-D warnings`
@ -11,63 +11,63 @@ error: usage of `contains_key` followed by `insert` on a `HashMap`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:25:5
|
25 | / if !m.contains_key(&k) {
26 | | foo();
27 | | m.insert(k, v);
28 | | }
LL | / if !m.contains_key(&k) {
LL | | foo();
LL | | m.insert(k, v);
LL | | }
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:32:5
|
32 | / if !m.contains_key(&k) {
33 | | m.insert(k, v)
34 | | } else {
35 | | None
36 | | };
LL | / if !m.contains_key(&k) {
LL | | m.insert(k, v)
LL | | } else {
LL | | None
LL | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:40:5
|
40 | / if m.contains_key(&k) {
41 | | None
42 | | } else {
43 | | m.insert(k, v)
44 | | };
LL | / if m.contains_key(&k) {
LL | | None
LL | | } else {
LL | | m.insert(k, v)
LL | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:48:5
|
48 | / if !m.contains_key(&k) {
49 | | foo();
50 | | m.insert(k, v)
51 | | } else {
52 | | None
53 | | };
LL | / if !m.contains_key(&k) {
LL | | foo();
LL | | m.insert(k, v)
LL | | } else {
LL | | None
LL | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `HashMap`
--> $DIR/entry.rs:57:5
|
57 | / if m.contains_key(&k) {
58 | | None
59 | | } else {
60 | | foo();
61 | | m.insert(k, v)
62 | | };
LL | / if m.contains_key(&k) {
LL | | None
LL | | } else {
LL | | foo();
LL | | m.insert(k, v)
LL | | };
| |_____^ help: consider using: `m.entry(k)`
error: usage of `contains_key` followed by `insert` on a `BTreeMap`
--> $DIR/entry.rs:66:5
|
66 | / if !m.contains_key(&k) {
67 | | foo();
68 | | m.insert(k, v)
69 | | } else {
70 | | None
71 | | };
LL | / if !m.contains_key(&k) {
LL | | foo();
LL | | m.insert(k, v)
LL | | } else {
LL | | None
LL | | };
| |_____^ help: consider using: `m.entry(k)`
error: aborting due to 7 previous errors

View file

@ -1,7 +1,7 @@
error: don't use glob imports for enum variants
--> $DIR/enum_glob_use.rs:13:1
|
13 | use std::cmp::Ordering::*;
LL | use std::cmp::Ordering::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::enum-glob-use` implied by `-D warnings`
@ -9,7 +9,7 @@ error: don't use glob imports for enum variants
error: don't use glob imports for enum variants
--> $DIR/enum_glob_use.rs:19:1
|
19 | use self::Enum::*;
LL | use self::Enum::*;
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -9,6 +9,7 @@
#![feature(non_ascii_idents)]
#![warn(clippy::all, clippy::pub_enum_variant_names)]
#![allow(non_camel_case_types)]
enum FakeCallType {
CALL,

View file

@ -1,101 +1,101 @@
error: Variant name ends with the enum's name
--> $DIR/enum_variants.rs:24:5
--> $DIR/enum_variants.rs:25:5
|
24 | cFoo,
LL | cFoo,
| ^^^^
|
= note: `-D clippy::enum-variant-names` implied by `-D warnings`
error: Variant name starts with the enum's name
--> $DIR/enum_variants.rs:35:5
|
35 | FoodGood,
| ^^^^^^^^
error: Variant name starts with the enum's name
--> $DIR/enum_variants.rs:36:5
|
36 | FoodMiddle,
| ^^^^^^^^^^
LL | FoodGood,
| ^^^^^^^^
error: Variant name starts with the enum's name
--> $DIR/enum_variants.rs:37:5
|
37 | FoodBad,
LL | FoodMiddle,
| ^^^^^^^^^^
error: Variant name starts with the enum's name
--> $DIR/enum_variants.rs:38:5
|
LL | FoodBad,
| ^^^^^^^
error: All variants have the same prefix: `Food`
--> $DIR/enum_variants.rs:34:1
--> $DIR/enum_variants.rs:35:1
|
34 | / enum Food {
35 | | FoodGood,
36 | | FoodMiddle,
37 | | FoodBad,
38 | | }
LL | / enum Food {
LL | | FoodGood,
LL | | FoodMiddle,
LL | | FoodBad,
LL | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: All variants have the same prefix: `CallType`
--> $DIR/enum_variants.rs:44:1
--> $DIR/enum_variants.rs:45:1
|
44 | / enum BadCallType {
45 | | CallTypeCall,
46 | | CallTypeCreate,
47 | | CallTypeDestroy,
48 | | }
LL | / enum BadCallType {
LL | | CallTypeCall,
LL | | CallTypeCreate,
LL | | CallTypeDestroy,
LL | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: All variants have the same prefix: `Constant`
--> $DIR/enum_variants.rs:56:1
--> $DIR/enum_variants.rs:57:1
|
56 | / enum Consts {
57 | | ConstantInt,
58 | | ConstantCake,
59 | | ConstantLie,
60 | | }
LL | / enum Consts {
LL | | ConstantInt,
LL | | ConstantCake,
LL | | ConstantLie,
LL | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: All variants have the same prefix: `With`
--> $DIR/enum_variants.rs:90:1
--> $DIR/enum_variants.rs:91:1
|
90 | / enum Seallll {
91 | | WithOutCake,
92 | | WithOutTea,
93 | | WithOut,
94 | | }
LL | / enum Seallll {
LL | | WithOutCake,
LL | | WithOutTea,
LL | | WithOut,
LL | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: All variants have the same prefix: `Prefix`
--> $DIR/enum_variants.rs:96:1
|
96 | / enum NonCaps {
97 | | Prefix的,
98 | | PrefixTea,
99 | | PrefixCake,
100 | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
--> $DIR/enum_variants.rs:97:1
|
LL | / enum NonCaps {
LL | | Prefix的,
LL | | PrefixTea,
LL | | PrefixCake,
LL | | }
| |_^
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: All variants have the same prefix: `With`
--> $DIR/enum_variants.rs:102:1
|
102 | / pub enum PubSeall {
103 | | WithOutCake,
104 | | WithOutTea,
105 | | WithOut,
106 | | }
| |_^
|
= note: `-D clippy::pub-enum-variant-names` implied by `-D warnings`
= help: remove the prefixes and use full paths to the variants instead of glob imports
--> $DIR/enum_variants.rs:103:1
|
LL | / pub enum PubSeall {
LL | | WithOutCake,
LL | | WithOutTea,
LL | | WithOut,
LL | | }
| |_^
|
= note: `-D clippy::pub-enum-variant-names` implied by `-D warnings`
= help: remove the prefixes and use full paths to the variants instead of glob imports
error: aborting due to 10 previous errors

View file

@ -1,7 +1,7 @@
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:17:5
|
17 | X = 0x1_0000_0000,
LL | X = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::enum-clike-unportable-variant` implied by `-D warnings`
@ -9,43 +9,43 @@ error: Clike enum variant discriminant is not portable to 32-bit targets
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:24:5
|
24 | X = 0x1_0000_0000,
LL | X = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:27:5
|
27 | A = 0xFFFF_FFFF,
LL | A = 0xFFFF_FFFF,
| ^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:34:5
|
34 | Z = 0xFFFF_FFFF,
LL | Z = 0xFFFF_FFFF,
| ^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:35:5
|
35 | A = 0x1_0000_0000,
LL | A = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:37:5
|
37 | C = (std::i32::MIN as isize) - 1,
LL | C = (std::i32::MIN as isize) - 1,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:43:5
|
43 | Z = 0xFFFF_FFFF,
LL | Z = 0xFFFF_FFFF,
| ^^^^^^^^^^^^^^^
error: Clike enum variant discriminant is not portable to 32-bit targets
--> $DIR/enums_clike.rs:44:5
|
44 | A = 0x1_0000_0000,
LL | A = 0x1_0000_0000,
| ^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors

View file

@ -1,7 +1,7 @@
error: this boolean expression can be simplified
--> $DIR/eq_op.rs:44:5
|
44 | true && true;
LL | true && true;
| ^^^^^^^^^^^^ help: try: `true`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
@ -9,37 +9,37 @@ error: this boolean expression can be simplified
error: this boolean expression can be simplified
--> $DIR/eq_op.rs:46:5
|
46 | true || true;
LL | true || true;
| ^^^^^^^^^^^^ help: try: `true`
error: this boolean expression can be simplified
--> $DIR/eq_op.rs:52:5
|
52 | a == b && b == a;
LL | a == b && b == a;
| ^^^^^^^^^^^^^^^^ help: try: `a == b`
error: this boolean expression can be simplified
--> $DIR/eq_op.rs:53:5
|
53 | a != b && b != a;
LL | a != b && b != a;
| ^^^^^^^^^^^^^^^^ help: try: `a != b`
error: this boolean expression can be simplified
--> $DIR/eq_op.rs:54:5
|
54 | a < b && b > a;
LL | a < b && b > a;
| ^^^^^^^^^^^^^^ help: try: `a < b`
error: this boolean expression can be simplified
--> $DIR/eq_op.rs:55:5
|
55 | a <= b && b >= a;
LL | a <= b && b >= a;
| ^^^^^^^^^^^^^^^^ help: try: `a <= b`
error: equal expressions as operands to `==`
--> $DIR/eq_op.rs:17:5
|
17 | 1 == 1;
LL | 1 == 1;
| ^^^^^^
|
= note: `-D clippy::eq-op` implied by `-D warnings`
@ -47,157 +47,157 @@ error: equal expressions as operands to `==`
error: equal expressions as operands to `==`
--> $DIR/eq_op.rs:18:5
|
18 | "no" == "no";
LL | "no" == "no";
| ^^^^^^^^^^^^
error: equal expressions as operands to `!=`
--> $DIR/eq_op.rs:20:5
|
20 | false != false;
LL | false != false;
| ^^^^^^^^^^^^^^
error: equal expressions as operands to `<`
--> $DIR/eq_op.rs:21:5
|
21 | 1.5 < 1.5;
LL | 1.5 < 1.5;
| ^^^^^^^^^
error: equal expressions as operands to `>=`
--> $DIR/eq_op.rs:22:5
|
22 | 1u64 >= 1u64;
LL | 1u64 >= 1u64;
| ^^^^^^^^^^^^
error: equal expressions as operands to `&`
--> $DIR/eq_op.rs:25:5
|
25 | (1 as u64) & (1 as u64);
LL | (1 as u64) & (1 as u64);
| ^^^^^^^^^^^^^^^^^^^^^^^
error: equal expressions as operands to `^`
--> $DIR/eq_op.rs:26:5
|
26 | 1 ^ ((((((1))))));
LL | 1 ^ ((((((1))))));
| ^^^^^^^^^^^^^^^^^
error: equal expressions as operands to `<`
--> $DIR/eq_op.rs:29:5
|
29 | (-(2) < -(2));
LL | (-(2) < -(2));
| ^^^^^^^^^^^^^
error: equal expressions as operands to `==`
--> $DIR/eq_op.rs:30:5
|
30 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
LL | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: equal expressions as operands to `&`
--> $DIR/eq_op.rs:30:6
|
30 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
LL | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
| ^^^^^^^^^^^^^^^^^
error: equal expressions as operands to `&`
--> $DIR/eq_op.rs:30:27
|
30 | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
LL | ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
| ^^^^^^^^^^^^^^^^^
error: equal expressions as operands to `==`
--> $DIR/eq_op.rs:31:5
|
31 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
LL | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: equal expressions as operands to `!=`
--> $DIR/eq_op.rs:34:5
|
34 | ([1] != [1]);
LL | ([1] != [1]);
| ^^^^^^^^^^^^
error: equal expressions as operands to `!=`
--> $DIR/eq_op.rs:35:5
|
35 | ((1, 2) != (1, 2));
LL | ((1, 2) != (1, 2));
| ^^^^^^^^^^^^^^^^^^
error: equal expressions as operands to `==`
--> $DIR/eq_op.rs:39:5
|
39 | 1 + 1 == 2;
LL | 1 + 1 == 2;
| ^^^^^^^^^^
error: equal expressions as operands to `==`
--> $DIR/eq_op.rs:40:5
|
40 | 1 - 1 == 0;
LL | 1 - 1 == 0;
| ^^^^^^^^^^
error: equal expressions as operands to `-`
--> $DIR/eq_op.rs:40:5
|
40 | 1 - 1 == 0;
LL | 1 - 1 == 0;
| ^^^^^
error: equal expressions as operands to `-`
--> $DIR/eq_op.rs:42:5
|
42 | 1 - 1;
LL | 1 - 1;
| ^^^^^
error: equal expressions as operands to `/`
--> $DIR/eq_op.rs:43:5
|
43 | 1 / 1;
LL | 1 / 1;
| ^^^^^
error: equal expressions as operands to `&&`
--> $DIR/eq_op.rs:44:5
|
44 | true && true;
LL | true && true;
| ^^^^^^^^^^^^
error: equal expressions as operands to `||`
--> $DIR/eq_op.rs:46:5
|
46 | true || true;
LL | true || true;
| ^^^^^^^^^^^^
error: equal expressions as operands to `&&`
--> $DIR/eq_op.rs:52:5
|
52 | a == b && b == a;
LL | a == b && b == a;
| ^^^^^^^^^^^^^^^^
error: equal expressions as operands to `&&`
--> $DIR/eq_op.rs:53:5
|
53 | a != b && b != a;
LL | a != b && b != a;
| ^^^^^^^^^^^^^^^^
error: equal expressions as operands to `&&`
--> $DIR/eq_op.rs:54:5
|
54 | a < b && b > a;
LL | a < b && b > a;
| ^^^^^^^^^^^^^^
error: equal expressions as operands to `&&`
--> $DIR/eq_op.rs:55:5
|
55 | a <= b && b >= a;
LL | a <= b && b >= a;
| ^^^^^^^^^^^^^^^^
error: equal expressions as operands to `==`
--> $DIR/eq_op.rs:58:5
|
58 | a == a;
LL | a == a;
| ^^^^^^
error: taken reference of right operand
--> $DIR/eq_op.rs:96:13
|
96 | let z = x & &y;
LL | let z = x & &y;
| ^^^^--
| |
| help: use the right value directly: `y`
@ -205,10 +205,10 @@ error: taken reference of right operand
= note: `-D clippy::op-ref` implied by `-D warnings`
error: equal expressions as operands to `/`
--> $DIR/eq_op.rs:104:20
|
104 | const D: u32 = A / A;
| ^^^^^
--> $DIR/eq_op.rs:104:20
|
LL | const D: u32 = A / A;
| ^^^^^
error: aborting due to 34 previous errors

View file

@ -1,7 +1,7 @@
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/erasing_op.rs:15:5
|
15 | x * 0;
LL | x * 0;
| ^^^^^
|
= note: `-D clippy::erasing-op` implied by `-D warnings`
@ -9,13 +9,13 @@ error: this operation will always return zero. This is likely not the intended o
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/erasing_op.rs:16:5
|
16 | 0 & x;
LL | 0 & x;
| ^^^^^
error: this operation will always return zero. This is likely not the intended outcome
--> $DIR/erasing_op.rs:17:5
|
17 | 0 / x;
LL | 0 / x;
| ^^^^^
error: aborting due to 3 previous errors

View file

@ -1,16 +1,16 @@
error: local variable doesn't need to be boxed here
--> $DIR/escape_analysis.rs:43:13
|
43 | fn warn_arg(x: Box<A>) {
LL | fn warn_arg(x: Box<A>) {
| ^
|
= note: `-D clippy::boxed-local` implied by `-D warnings`
error: local variable doesn't need to be boxed here
--> $DIR/escape_analysis.rs:134:12
|
134 | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
| ^^^^^^^^^^^
--> $DIR/escape_analysis.rs:134:12
|
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
| ^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,7 +1,7 @@
error: redundant closure found
--> $DIR/eta.rs:22:27
|
22 | let a = Some(1u8).map(|a| foo(a));
LL | let a = Some(1u8).map(|a| foo(a));
| ^^^^^^^^^^ help: remove closure as shown: `foo`
|
= note: `-D clippy::redundant-closure` implied by `-D warnings`
@ -9,19 +9,19 @@ error: redundant closure found
error: redundant closure found
--> $DIR/eta.rs:23:10
|
23 | meta(|a| foo(a));
LL | meta(|a| foo(a));
| ^^^^^^^^^^ help: remove closure as shown: `foo`
error: redundant closure found
--> $DIR/eta.rs:24:27
|
24 | let c = Some(1u8).map(|a| {1+2; foo}(a));
LL | let c = Some(1u8).map(|a| {1+2; foo}(a));
| ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}`
error: this expression borrows a reference that is immediately dereferenced by the compiler
--> $DIR/eta.rs:26:21
|
26 | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
| ^^^ help: change this to: `&2`
|
= note: `-D clippy::needless-borrow` implied by `-D warnings`
@ -29,7 +29,7 @@ error: this expression borrows a reference that is immediately dereferenced by t
error: redundant closure found
--> $DIR/eta.rs:33:27
|
33 | let e = Some(1u8).map(|a| generic(a));
LL | let e = Some(1u8).map(|a| generic(a));
| ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
error: aborting due to 5 previous errors

View file

@ -1,50 +1,50 @@
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:24:9
|
24 | } + x;
LL | } + x;
| ^
|
= note: `-D clippy::eval-order-dependence` implied by `-D warnings`
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:22:9
|
22 | x = 1;
LL | x = 1;
| ^^^^^
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:27:5
|
27 | x += {
LL | x += {
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:28:9
|
28 | x = 20;
LL | x = 20;
| ^^^^^^
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:40:12
|
40 | a: x,
LL | a: x,
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:42:13
|
42 | x = 6;
LL | x = 6;
| ^^^^^
error: unsequenced read of a variable
--> $DIR/eval_order_dependence.rs:49:9
|
49 | x += {
LL | x += {
| ^
|
note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:50:13
|
50 | x = 20;
LL | x = 20;
| ^^^^^^
error: aborting due to 4 previous errors

View file

@ -1,7 +1,7 @@
error: float has excessive precision
--> $DIR/excessive_precision.rs:23:26
|
23 | const BAD32_1: f32 = 0.123_456_789_f32;
LL | const BAD32_1: f32 = 0.123_456_789_f32;
| ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79`
|
= note: `-D clippy::excessive-precision` implied by `-D warnings`
@ -9,103 +9,103 @@ error: float has excessive precision
error: float has excessive precision
--> $DIR/excessive_precision.rs:24:26
|
24 | const BAD32_2: f32 = 0.123_456_789;
LL | const BAD32_2: f32 = 0.123_456_789;
| ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79`
error: float has excessive precision
--> $DIR/excessive_precision.rs:25:26
|
25 | const BAD32_3: f32 = 0.100_000_000_000_1;
LL | const BAD32_3: f32 = 0.100_000_000_000_1;
| ^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1`
error: float has excessive precision
--> $DIR/excessive_precision.rs:26:29
|
26 | const BAD32_EDGE: f32 = 1.000_000_9;
LL | const BAD32_EDGE: f32 = 1.000_000_9;
| ^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.000_001`
error: float has excessive precision
--> $DIR/excessive_precision.rs:28:26
|
28 | const BAD64_1: f64 = 0.123_456_789_012_345_67f64;
LL | const BAD64_1: f64 = 0.123_456_789_012_345_67f64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:29:26
|
29 | const BAD64_2: f64 = 0.123_456_789_012_345_67;
LL | const BAD64_2: f64 = 0.123_456_789_012_345_67;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:30:26
|
30 | const BAD64_3: f64 = 0.100_000_000_000_000_000_1;
LL | const BAD64_3: f64 = 0.100_000_000_000_000_000_1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.1`
error: float has excessive precision
--> $DIR/excessive_precision.rs:33:22
|
33 | println!("{:?}", 8.888_888_888_888_888_888_888);
LL | println!("{:?}", 8.888_888_888_888_888_888_888);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `8.888_888_888_888_89`
error: float has excessive precision
--> $DIR/excessive_precision.rs:44:22
|
44 | let bad32: f32 = 1.123_456_789;
LL | let bad32: f32 = 1.123_456_789;
| ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8`
error: float has excessive precision
--> $DIR/excessive_precision.rs:45:26
|
45 | let bad32_suf: f32 = 1.123_456_789_f32;
LL | let bad32_suf: f32 = 1.123_456_789_f32;
| ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8`
error: float has excessive precision
--> $DIR/excessive_precision.rs:46:21
|
46 | let bad32_inf = 1.123_456_789_f32;
LL | let bad32_inf = 1.123_456_789_f32;
| ^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8`
error: float has excessive precision
--> $DIR/excessive_precision.rs:48:22
|
48 | let bad64: f64 = 0.123_456_789_012_345_67;
LL | let bad64: f64 = 0.123_456_789_012_345_67;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:49:26
|
49 | let bad64_suf: f64 = 0.123_456_789_012_345_67f64;
LL | let bad64_suf: f64 = 0.123_456_789_012_345_67f64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:50:21
|
50 | let bad64_inf = 0.123_456_789_012_345_67;
LL | let bad64_inf = 0.123_456_789_012_345_67;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_012_345_66`
error: float has excessive precision
--> $DIR/excessive_precision.rs:56:36
|
56 | let bad_vec32: Vec<f32> = vec![0.123_456_789];
LL | let bad_vec32: Vec<f32> = vec![0.123_456_789];
| ^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_79`
error: float has excessive precision
--> $DIR/excessive_precision.rs:57:36
|
57 | let bad_vec64: Vec<f64> = vec![0.123_456_789_123_456_789];
LL | let bad_vec64: Vec<f64> = vec![0.123_456_789_123_456_789];
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `0.123_456_789_123_456_78`
error: float has excessive precision
--> $DIR/excessive_precision.rs:61:24
|
61 | let bad_e32: f32 = 1.123_456_788_888e-10;
LL | let bad_e32: f32 = 1.123_456_788_888e-10;
| ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8e-10`
error: float has excessive precision
--> $DIR/excessive_precision.rs:64:27
|
64 | let bad_bige32: f32 = 1.123_456_788_888E-10;
LL | let bad_bige32: f32 = 1.123_456_788_888E-10;
| ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `1.123_456_8E-10`
error: aborting due to 18 previous errors

View file

@ -1,7 +1,7 @@
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:36:26
|
36 | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
LL | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
= note: `-D clippy::expect-fun-call` implied by `-D warnings`
@ -9,31 +9,31 @@ error: use of `expect` followed by a function call
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:39:26
|
39 | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
LL | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:49:25
|
49 | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
LL | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:52:25
|
52 | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
LL | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:67:17
|
67 | Some("foo").expect({ &format!("error") });
LL | Some("foo").expect({ &format!("error") });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { let msg = { &format!("error") }; panic!(msg) }))`
error: use of `expect` followed by a function call
--> $DIR/expect_fun_call.rs:68:17
|
68 | Some("foo").expect(format!("error").as_ref());
LL | Some("foo").expect(format!("error").as_ref());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("error"))`
error: aborting due to 6 previous errors

View file

@ -1,7 +1,7 @@
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
--> $DIR/explicit_counter_loop.rs:15:15
|
15 | for _v in &vec {
LL | for _v in &vec {
| ^^^^
|
= note: `-D clippy::explicit-counter-loop` implied by `-D warnings`
@ -9,19 +9,19 @@ error: the variable `_index` is used as a loop counter. Consider using `for (_in
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
--> $DIR/explicit_counter_loop.rs:21:15
|
21 | for _v in &vec {
LL | for _v in &vec {
| ^^^^
error: the variable `count` is used as a loop counter. Consider using `for (count, item) in text.chars().enumerate()` or similar iterators
--> $DIR/explicit_counter_loop.rs:60:19
|
60 | for ch in text.chars() {
LL | for ch in text.chars() {
| ^^^^^^^^^^^^
error: the variable `count` is used as a loop counter. Consider using `for (count, item) in text.chars().enumerate()` or similar iterators
--> $DIR/explicit_counter_loop.rs:71:19
|
71 | for ch in text.chars() {
LL | for ch in text.chars() {
| ^^^^^^^^^^^^
error: aborting due to 4 previous errors

View file

@ -1,7 +1,7 @@
error: use of `write!(stdout(), ...).unwrap()`
--> $DIR/explicit_write.rs:24:9
|
24 | write!(std::io::stdout(), "test").unwrap();
LL | write!(std::io::stdout(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `print!("test")`
|
= note: `-D clippy::explicit-write` implied by `-D warnings`
@ -9,43 +9,43 @@ error: use of `write!(stdout(), ...).unwrap()`
error: use of `write!(stderr(), ...).unwrap()`
--> $DIR/explicit_write.rs:25:9
|
25 | write!(std::io::stderr(), "test").unwrap();
LL | write!(std::io::stderr(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprint!("test")`
error: use of `writeln!(stdout(), ...).unwrap()`
--> $DIR/explicit_write.rs:26:9
|
26 | writeln!(std::io::stdout(), "test").unwrap();
LL | writeln!(std::io::stdout(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `println!("test")`
error: use of `writeln!(stderr(), ...).unwrap()`
--> $DIR/explicit_write.rs:27:9
|
27 | writeln!(std::io::stderr(), "test").unwrap();
LL | writeln!(std::io::stderr(), "test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("test")`
error: use of `stdout().write_fmt(...).unwrap()`
--> $DIR/explicit_write.rs:28:9
|
28 | std::io::stdout().write_fmt(format_args!("test")).unwrap();
LL | std::io::stdout().write_fmt(format_args!("test")).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `print!("test")`
error: use of `stderr().write_fmt(...).unwrap()`
--> $DIR/explicit_write.rs:29:9
|
29 | std::io::stderr().write_fmt(format_args!("test")).unwrap();
LL | std::io::stderr().write_fmt(format_args!("test")).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprint!("test")`
error: use of `writeln!(stdout(), ...).unwrap()`
--> $DIR/explicit_write.rs:32:9
|
32 | writeln!(std::io::stdout(), "test/ntest").unwrap();
LL | writeln!(std::io::stdout(), "test/ntest").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `println!("test/ntest")`
error: use of `writeln!(stderr(), ...).unwrap()`
--> $DIR/explicit_write.rs:33:9
|
33 | writeln!(std::io::stderr(), "test/ntest").unwrap();
LL | writeln!(std::io::stderr(), "test/ntest").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("test/ntest")`
error: aborting due to 8 previous errors

View file

@ -1,91 +1,91 @@
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:14:1
|
14 | / impl From<String> for Foo {
15 | | fn from(s: String) -> Self {
16 | | Foo(s.parse().unwrap())
17 | | }
18 | | }
LL | / impl From<String> for Foo {
LL | | fn from(s: String) -> Self {
LL | | Foo(s.parse().unwrap())
LL | | }
LL | | }
| |_^
|
note: lint level defined here
--> $DIR/fallible_impl_from.rs:10:9
|
10 | #![deny(clippy::fallible_impl_from)]
LL | #![deny(clippy::fallible_impl_from)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:16:13
|
16 | Foo(s.parse().unwrap())
LL | Foo(s.parse().unwrap())
| ^^^^^^^^^^^^^^^^^^
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:35:1
|
35 | / impl From<usize> for Invalid {
36 | | fn from(i: usize) -> Invalid {
37 | | if i != 42 {
38 | | panic!();
LL | / impl From<usize> for Invalid {
LL | | fn from(i: usize) -> Invalid {
LL | | if i != 42 {
LL | | panic!();
... |
41 | | }
42 | | }
LL | | }
LL | | }
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:38:13
|
38 | panic!();
LL | panic!();
| ^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:44:1
|
44 | / impl From<Option<String>> for Invalid {
45 | | fn from(s: Option<String>) -> Invalid {
46 | | let s = s.unwrap();
47 | | if !s.is_empty() {
LL | / impl From<Option<String>> for Invalid {
LL | | fn from(s: Option<String>) -> Invalid {
LL | | let s = s.unwrap();
LL | | if !s.is_empty() {
... |
53 | | }
54 | | }
LL | | }
LL | | }
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:46:17
|
46 | let s = s.unwrap();
LL | let s = s.unwrap();
| ^^^^^^^^^^
47 | if !s.is_empty() {
48 | panic!(42);
LL | if !s.is_empty() {
LL | panic!(42);
| ^^^^^^^^^^^
49 | } else if s.parse::<u32>().unwrap() != 42 {
LL | } else if s.parse::<u32>().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
50 | panic!("{:?}", s);
LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: consider implementing `TryFrom` instead
--> $DIR/fallible_impl_from.rs:62:1
|
62 | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid {
63 | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
64 | | if s.parse::<u32>().ok().unwrap() != 42 {
65 | | panic!("{:?}", s);
LL | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid {
LL | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
LL | | if s.parse::<u32>().ok().unwrap() != 42 {
LL | | panic!("{:?}", s);
... |
68 | | }
69 | | }
LL | | }
LL | | }
| |_^
|
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:64:12
|
64 | if s.parse::<u32>().ok().unwrap() != 42 {
LL | if s.parse::<u32>().ok().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65 | panic!("{:?}", s);
LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

View file

@ -1,7 +1,7 @@
error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
--> $DIR/filter_methods.rs:14:21
|
14 | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::filter-map` implied by `-D warnings`
@ -9,31 +9,31 @@ error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expre
error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
--> $DIR/filter_methods.rs:16:21
|
16 | let _: Vec<_> = vec![5_i8; 6]
LL | let _: Vec<_> = vec![5_i8; 6]
| _____________________^
17 | | .into_iter()
18 | | .filter(|&x| x == 0)
19 | | .flat_map(|x| x.checked_mul(2))
LL | | .into_iter()
LL | | .filter(|&x| x == 0)
LL | | .flat_map(|x| x.checked_mul(2))
| |_______________________________________^
error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
--> $DIR/filter_methods.rs:22:21
|
22 | let _: Vec<_> = vec![5_i8; 6]
LL | let _: Vec<_> = vec![5_i8; 6]
| _____________________^
23 | | .into_iter()
24 | | .filter_map(|x| x.checked_mul(2))
25 | | .flat_map(|x| x.checked_mul(2))
LL | | .into_iter()
LL | | .filter_map(|x| x.checked_mul(2))
LL | | .flat_map(|x| x.checked_mul(2))
| |_______________________________________^
error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead.
--> $DIR/filter_methods.rs:28:21
|
28 | let _: Vec<_> = vec![5_i8; 6]
LL | let _: Vec<_> = vec![5_i8; 6]
| _____________________^
29 | | .into_iter()
30 | | .filter_map(|x| x.checked_mul(2))
31 | | .map(|x| x.checked_mul(2))
LL | | .into_iter()
LL | | .filter_map(|x| x.checked_mul(2))
LL | | .map(|x| x.checked_mul(2))
| |__________________________________^
error: aborting due to 4 previous errors

Some files were not shown because too many files have changed in this diff Show more