Auto merge of #9069 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
0cb0f76368
43 changed files with 267 additions and 289 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clippy"
|
name = "clippy"
|
||||||
version = "0.1.63"
|
version = "0.1.64"
|
||||||
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
|
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
|
||||||
repository = "https://github.com/rust-lang/rust-clippy"
|
repository = "https://github.com/rust-lang/rust-clippy"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
use crate::cargo_clippy_path;
|
use crate::cargo_clippy_path;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::lazy::SyncLazy;
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::sync::LazyLock;
|
||||||
use walkdir::{DirEntry, WalkDir};
|
use walkdir::{DirEntry, WalkDir};
|
||||||
|
|
||||||
static CLIPPY_BUILD_TIME: SyncLazy<Option<std::time::SystemTime>> =
|
static CLIPPY_BUILD_TIME: LazyLock<Option<std::time::SystemTime>> =
|
||||||
SyncLazy::new(|| cargo_clippy_path().metadata().ok()?.modified().ok());
|
LazyLock::new(|| cargo_clippy_path().metadata().ok()?.modified().ok());
|
||||||
|
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clippy_lints"
|
name = "clippy_lints"
|
||||||
version = "0.1.63"
|
version = "0.1.64"
|
||||||
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
|
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
|
||||||
repository = "https://github.com/rust-lang/rust-clippy"
|
repository = "https://github.com/rust-lang/rust-clippy"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use clippy_utils::diagnostics::span_lint_and_sugg_for_edges;
|
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||||
use clippy_utils::is_trait_method;
|
use clippy_utils::is_trait_method;
|
||||||
use clippy_utils::source::snippet_with_applicability;
|
use clippy_utils::source::snippet_with_applicability;
|
||||||
use clippy_utils::ty::is_type_diagnostic_item;
|
use clippy_utils::ty::is_type_diagnostic_item;
|
||||||
|
@ -14,17 +14,17 @@ use super::MAP_FLATTEN;
|
||||||
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, map_arg: &Expr<'_>, map_span: Span) {
|
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, map_arg: &Expr<'_>, map_span: Span) {
|
||||||
if let Some((caller_ty_name, method_to_use)) = try_get_caller_ty_name_and_method_name(cx, expr, recv, map_arg) {
|
if let Some((caller_ty_name, method_to_use)) = try_get_caller_ty_name_and_method_name(cx, expr, recv, map_arg) {
|
||||||
let mut applicability = Applicability::MachineApplicable;
|
let mut applicability = Applicability::MachineApplicable;
|
||||||
let help_msgs = [
|
|
||||||
&format!("try replacing `map` with `{}`", method_to_use),
|
|
||||||
"and remove the `.flatten()`",
|
|
||||||
];
|
|
||||||
let closure_snippet = snippet_with_applicability(cx, map_arg.span, "..", &mut applicability);
|
let closure_snippet = snippet_with_applicability(cx, map_arg.span, "..", &mut applicability);
|
||||||
span_lint_and_sugg_for_edges(
|
span_lint_and_sugg(
|
||||||
cx,
|
cx,
|
||||||
MAP_FLATTEN,
|
MAP_FLATTEN,
|
||||||
expr.span.with_lo(map_span.lo()),
|
expr.span.with_lo(map_span.lo()),
|
||||||
&format!("called `map(..).flatten()` on `{}`", caller_ty_name),
|
&format!("called `map(..).flatten()` on `{}`", caller_ty_name),
|
||||||
&help_msgs,
|
&format!(
|
||||||
|
"try replacing `map` with `{}` and remove the `.flatten()`",
|
||||||
|
method_to_use
|
||||||
|
),
|
||||||
format!("{}({})", method_to_use, closure_snippet),
|
format!("{}({})", method_to_use, closure_snippet),
|
||||||
applicability,
|
applicability,
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,7 +4,6 @@ use clippy_utils::source::{snippet, snippet_with_applicability, snippet_with_mac
|
||||||
use clippy_utils::ty::{implements_trait, match_type};
|
use clippy_utils::ty::{implements_trait, match_type};
|
||||||
use clippy_utils::{contains_return, is_trait_item, last_path_segment, paths};
|
use clippy_utils::{contains_return, is_trait_item, last_path_segment, paths};
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
use rustc_errors::emitter::MAX_SUGGESTION_HIGHLIGHT_LINES;
|
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_lint::LateContext;
|
use rustc_lint::LateContext;
|
||||||
|
@ -33,7 +32,6 @@ pub(super) fn check<'tcx>(
|
||||||
arg: &hir::Expr<'_>,
|
arg: &hir::Expr<'_>,
|
||||||
or_has_args: bool,
|
or_has_args: bool,
|
||||||
span: Span,
|
span: Span,
|
||||||
method_span: Span,
|
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let is_default_default = || is_trait_item(cx, fun, sym::Default);
|
let is_default_default = || is_trait_item(cx, fun, sym::Default);
|
||||||
|
|
||||||
|
@ -56,19 +54,14 @@ pub(super) fn check<'tcx>(
|
||||||
then {
|
then {
|
||||||
let mut applicability = Applicability::MachineApplicable;
|
let mut applicability = Applicability::MachineApplicable;
|
||||||
let hint = "unwrap_or_default()";
|
let hint = "unwrap_or_default()";
|
||||||
let mut sugg_span = span;
|
let sugg_span = span;
|
||||||
|
|
||||||
let mut sugg: String = format!(
|
let sugg: String = format!(
|
||||||
"{}.{}",
|
"{}.{}",
|
||||||
snippet_with_applicability(cx, self_expr.span, "..", &mut applicability),
|
snippet_with_applicability(cx, self_expr.span, "..", &mut applicability),
|
||||||
hint
|
hint
|
||||||
);
|
);
|
||||||
|
|
||||||
if sugg.lines().count() > MAX_SUGGESTION_HIGHLIGHT_LINES {
|
|
||||||
sugg_span = method_span.with_hi(span.hi());
|
|
||||||
sugg = hint.to_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
cx,
|
cx,
|
||||||
OR_FUN_CALL,
|
OR_FUN_CALL,
|
||||||
|
@ -178,7 +171,7 @@ pub(super) fn check<'tcx>(
|
||||||
match inner_arg.kind {
|
match inner_arg.kind {
|
||||||
hir::ExprKind::Call(fun, or_args) => {
|
hir::ExprKind::Call(fun, or_args) => {
|
||||||
let or_has_args = !or_args.is_empty();
|
let or_has_args = !or_args.is_empty();
|
||||||
if !check_unwrap_or_default(cx, name, fun, self_arg, arg, or_has_args, expr.span, method_span) {
|
if !check_unwrap_or_default(cx, name, fun, self_arg, arg, or_has_args, expr.span) {
|
||||||
let fun_span = if or_has_args { None } else { Some(fun.span) };
|
let fun_span = if or_has_args { None } else { Some(fun.span) };
|
||||||
check_general_case(cx, name, method_span, self_arg, arg, expr.span, fun_span);
|
check_general_case(cx, name, method_span, self_arg, arg, expr.span, fun_span);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ macro_rules! RENAME_VALUE_TEMPLATE {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const LINT_EMISSION_FUNCTIONS: [&[&str]; 8] = [
|
const LINT_EMISSION_FUNCTIONS: [&[&str]; 7] = [
|
||||||
&["clippy_utils", "diagnostics", "span_lint"],
|
&["clippy_utils", "diagnostics", "span_lint"],
|
||||||
&["clippy_utils", "diagnostics", "span_lint_and_help"],
|
&["clippy_utils", "diagnostics", "span_lint_and_help"],
|
||||||
&["clippy_utils", "diagnostics", "span_lint_and_note"],
|
&["clippy_utils", "diagnostics", "span_lint_and_note"],
|
||||||
|
@ -112,7 +112,6 @@ const LINT_EMISSION_FUNCTIONS: [&[&str]; 8] = [
|
||||||
&["clippy_utils", "diagnostics", "span_lint_and_sugg"],
|
&["clippy_utils", "diagnostics", "span_lint_and_sugg"],
|
||||||
&["clippy_utils", "diagnostics", "span_lint_and_then"],
|
&["clippy_utils", "diagnostics", "span_lint_and_then"],
|
||||||
&["clippy_utils", "diagnostics", "span_lint_hir_and_then"],
|
&["clippy_utils", "diagnostics", "span_lint_hir_and_then"],
|
||||||
&["clippy_utils", "diagnostics", "span_lint_and_sugg_for_edges"],
|
|
||||||
];
|
];
|
||||||
const SUGGESTION_DIAGNOSTIC_BUILDER_METHODS: [(&str, bool); 9] = [
|
const SUGGESTION_DIAGNOSTIC_BUILDER_METHODS: [(&str, bool); 9] = [
|
||||||
("span_suggestion", false),
|
("span_suggestion", false),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clippy_utils"
|
name = "clippy_utils"
|
||||||
version = "0.1.63"
|
version = "0.1.64"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//! Thank you!
|
//! Thank you!
|
||||||
//! ~The `INTERNAL_METADATA_COLLECTOR` lint
|
//! ~The `INTERNAL_METADATA_COLLECTOR` lint
|
||||||
|
|
||||||
use rustc_errors::{emitter::MAX_SUGGESTION_HIGHLIGHT_LINES, Applicability, Diagnostic, MultiSpan};
|
use rustc_errors::{Applicability, Diagnostic, MultiSpan};
|
||||||
use rustc_hir::HirId;
|
use rustc_hir::HirId;
|
||||||
use rustc_lint::{LateContext, Lint, LintContext};
|
use rustc_lint::{LateContext, Lint, LintContext};
|
||||||
use rustc_span::source_map::Span;
|
use rustc_span::source_map::Span;
|
||||||
|
@ -213,93 +213,6 @@ pub fn span_lint_and_sugg<'a, T: LintContext>(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like [`span_lint_and_sugg`] with a focus on the edges. The output will either
|
|
||||||
/// emit single span or multispan suggestion depending on the number of its lines.
|
|
||||||
///
|
|
||||||
/// If the given suggestion string has more lines than the maximum display length defined by
|
|
||||||
/// [`MAX_SUGGESTION_HIGHLIGHT_LINES`][`rustc_errors::emitter::MAX_SUGGESTION_HIGHLIGHT_LINES`],
|
|
||||||
/// this function will split the suggestion and span to showcase the change for the top and
|
|
||||||
/// bottom edge of the code. For normal suggestions, in one display window, the help message
|
|
||||||
/// will be combined with a colon.
|
|
||||||
///
|
|
||||||
/// Multipart suggestions like the one being created here currently cannot be
|
|
||||||
/// applied by rustfix (See [rustfix#141](https://github.com/rust-lang/rustfix/issues/141)).
|
|
||||||
/// Testing rustfix with this lint emission function might require a file with
|
|
||||||
/// suggestions that can be fixed and those that can't. See
|
|
||||||
/// [clippy#8520](https://github.com/rust-lang/rust-clippy/pull/8520/files) for
|
|
||||||
/// an example and of this.
|
|
||||||
///
|
|
||||||
/// # Example for a long suggestion
|
|
||||||
///
|
|
||||||
/// ```text
|
|
||||||
/// error: called `map(..).flatten()` on `Option`
|
|
||||||
/// --> $DIR/map_flatten.rs:8:10
|
|
||||||
/// |
|
|
||||||
/// LL | .map(|x| {
|
|
||||||
/// | __________^
|
|
||||||
/// LL | | if x <= 5 {
|
|
||||||
/// LL | | Some(x)
|
|
||||||
/// LL | | } else {
|
|
||||||
/// ... |
|
|
||||||
/// LL | | })
|
|
||||||
/// LL | | .flatten();
|
|
||||||
/// | |__________________^
|
|
||||||
/// |
|
|
||||||
/// = note: `-D clippy::map-flatten` implied by `-D warnings`
|
|
||||||
/// help: try replacing `map` with `and_then`
|
|
||||||
/// |
|
|
||||||
/// LL ~ .and_then(|x| {
|
|
||||||
/// LL + if x <= 5 {
|
|
||||||
/// LL + Some(x)
|
|
||||||
/// |
|
|
||||||
/// help: and remove the `.flatten()`
|
|
||||||
/// |
|
|
||||||
/// LL + None
|
|
||||||
/// LL + }
|
|
||||||
/// LL ~ });
|
|
||||||
/// |
|
|
||||||
/// ```
|
|
||||||
pub fn span_lint_and_sugg_for_edges(
|
|
||||||
cx: &LateContext<'_>,
|
|
||||||
lint: &'static Lint,
|
|
||||||
sp: Span,
|
|
||||||
msg: &str,
|
|
||||||
helps: &[&str; 2],
|
|
||||||
sugg: String,
|
|
||||||
applicability: Applicability,
|
|
||||||
) {
|
|
||||||
span_lint_and_then(cx, lint, sp, msg, |diag| {
|
|
||||||
let sugg_lines_count = sugg.lines().count();
|
|
||||||
if sugg_lines_count > MAX_SUGGESTION_HIGHLIGHT_LINES {
|
|
||||||
let sm = cx.sess().source_map();
|
|
||||||
if let (Ok(line_upper), Ok(line_bottom)) = (sm.lookup_line(sp.lo()), sm.lookup_line(sp.hi())) {
|
|
||||||
let split_idx = MAX_SUGGESTION_HIGHLIGHT_LINES / 2;
|
|
||||||
let span_upper = sm.span_until_char(
|
|
||||||
sp.with_hi(line_upper.sf.lines(|lines| lines[line_upper.line + split_idx])),
|
|
||||||
'\n',
|
|
||||||
);
|
|
||||||
let span_bottom = sp.with_lo(line_bottom.sf.lines(|lines| lines[line_bottom.line - split_idx]));
|
|
||||||
|
|
||||||
let sugg_lines_vec = sugg.lines().collect::<Vec<&str>>();
|
|
||||||
let sugg_upper = sugg_lines_vec[..split_idx].join("\n");
|
|
||||||
let sugg_bottom = sugg_lines_vec[sugg_lines_count - split_idx..].join("\n");
|
|
||||||
|
|
||||||
diag.span_suggestion(span_upper, helps[0], sugg_upper, applicability);
|
|
||||||
diag.span_suggestion(span_bottom, helps[1], sugg_bottom, applicability);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diag.span_suggestion_with_style(
|
|
||||||
sp,
|
|
||||||
&helps.join(", "),
|
|
||||||
sugg,
|
|
||||||
applicability,
|
|
||||||
rustc_errors::SuggestionStyle::ShowAlways,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a suggestion made from several `span → replacement`.
|
/// Create a suggestion made from several `span → replacement`.
|
||||||
///
|
///
|
||||||
/// Note: in the JSON format (used by `compiletest_rs`), the help message will
|
/// Note: in the JSON format (used by `compiletest_rs`), the help message will
|
||||||
|
|
|
@ -16,6 +16,10 @@ use rustc_middle::ty::TypeckResults;
|
||||||
use rustc_span::{sym, Symbol};
|
use rustc_span::{sym, Symbol};
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
|
/// Callback that is called when two expressions are not equal in the sense of `SpanlessEq`, but
|
||||||
|
/// other conditions would make them equal.
|
||||||
|
type SpanlessEqCallback<'a> = dyn FnMut(&Expr<'_>, &Expr<'_>) -> bool + 'a;
|
||||||
|
|
||||||
/// Type used to check whether two ast are the same. This is different from the
|
/// Type used to check whether two ast are the same. This is different from the
|
||||||
/// operator `==` on ast types as this operator would compare true equality with
|
/// operator `==` on ast types as this operator would compare true equality with
|
||||||
/// ID and span.
|
/// ID and span.
|
||||||
|
@ -26,7 +30,7 @@ pub struct SpanlessEq<'a, 'tcx> {
|
||||||
cx: &'a LateContext<'tcx>,
|
cx: &'a LateContext<'tcx>,
|
||||||
maybe_typeck_results: Option<(&'tcx TypeckResults<'tcx>, &'tcx TypeckResults<'tcx>)>,
|
maybe_typeck_results: Option<(&'tcx TypeckResults<'tcx>, &'tcx TypeckResults<'tcx>)>,
|
||||||
allow_side_effects: bool,
|
allow_side_effects: bool,
|
||||||
expr_fallback: Option<Box<dyn FnMut(&Expr<'_>, &Expr<'_>) -> bool + 'a>>,
|
expr_fallback: Option<Box<SpanlessEqCallback<'a>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
|
impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
|
||||||
|
|
|
@ -64,7 +64,7 @@ pub use self::hir_utils::{
|
||||||
|
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::hash::BuildHasherDefault;
|
use std::hash::BuildHasherDefault;
|
||||||
use std::lazy::SyncOnceCell;
|
use std::sync::OnceLock;
|
||||||
use std::sync::{Mutex, MutexGuard};
|
use std::sync::{Mutex, MutexGuard};
|
||||||
|
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
|
@ -2099,7 +2099,7 @@ pub fn is_hir_ty_cfg_dependant(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
static TEST_ITEM_NAMES_CACHE: SyncOnceCell<Mutex<FxHashMap<LocalDefId, Vec<Symbol>>>> = SyncOnceCell::new();
|
static TEST_ITEM_NAMES_CACHE: OnceLock<Mutex<FxHashMap<LocalDefId, Vec<Symbol>>>> = OnceLock::new();
|
||||||
|
|
||||||
fn with_test_item_names<'tcx>(tcx: TyCtxt<'tcx>, module: LocalDefId, f: impl Fn(&[Symbol]) -> bool) -> bool {
|
fn with_test_item_names<'tcx>(tcx: TyCtxt<'tcx>, module: LocalDefId, f: impl Fn(&[Symbol]) -> bool) -> bool {
|
||||||
let cache = TEST_ITEM_NAMES_CACHE.get_or_init(|| Mutex::new(FxHashMap::default()));
|
let cache = TEST_ITEM_NAMES_CACHE.get_or_init(|| Mutex::new(FxHashMap::default()));
|
||||||
|
|
|
@ -771,7 +771,7 @@ impl<T: LintContext> DiagnosticExt<T> for rustc_errors::Diagnostic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.span_suggestion(remove_span, msg, String::new(), applicability);
|
self.span_suggestion(remove_span, msg, "", applicability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2022-06-16"
|
channel = "nightly-2022-06-30"
|
||||||
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
||||||
|
|
|
@ -21,11 +21,11 @@ use rustc_tools_util::VersionInfo;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::lazy::SyncLazy;
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::panic;
|
use std::panic;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{exit, Command};
|
use std::process::{exit, Command};
|
||||||
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
/// If a command-line option matches `find_arg`, then apply the predicate `pred` on its value. If
|
/// If a command-line option matches `find_arg`, then apply the predicate `pred` on its value. If
|
||||||
/// true, then return it. The parameter is assumed to be either `--arg=value` or `--arg value`.
|
/// true, then return it. The parameter is assumed to be either `--arg=value` or `--arg value`.
|
||||||
|
@ -153,7 +153,8 @@ You can use tool lints to allow or deny lints from your code, eg.:
|
||||||
|
|
||||||
const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new";
|
const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new";
|
||||||
|
|
||||||
static ICE_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> = SyncLazy::new(|| {
|
type PanicCallback = dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static;
|
||||||
|
static ICE_HOOK: LazyLock<Box<PanicCallback>> = LazyLock::new(|| {
|
||||||
let hook = panic::take_hook();
|
let hook = panic::take_hook();
|
||||||
panic::set_hook(Box::new(|info| report_clippy_ice(info, BUG_REPORT_URL)));
|
panic::set_hook(Box::new(|info| report_clippy_ice(info, BUG_REPORT_URL)));
|
||||||
hook
|
hook
|
||||||
|
@ -220,7 +221,7 @@ fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<Pat
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
rustc_driver::init_rustc_env_logger();
|
rustc_driver::init_rustc_env_logger();
|
||||||
SyncLazy::force(&ICE_HOOK);
|
LazyLock::force(&ICE_HOOK);
|
||||||
exit(rustc_driver::catch_with_exit_code(move || {
|
exit(rustc_driver::catch_with_exit_code(move || {
|
||||||
let mut orig_args: Vec<String> = env::args().collect();
|
let mut orig_args: Vec<String> = env::args().collect();
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ use std::env::{self, remove_var, set_var, var_os};
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::lazy::SyncLazy;
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::sync::LazyLock;
|
||||||
use test_utils::IS_RUSTC_TEST_SUITE;
|
use test_utils::IS_RUSTC_TEST_SUITE;
|
||||||
|
|
||||||
mod test_utils;
|
mod test_utils;
|
||||||
|
@ -75,7 +75,7 @@ extern crate tokio;
|
||||||
/// dependencies must be added to Cargo.toml at the project root. Test
|
/// dependencies must be added to Cargo.toml at the project root. Test
|
||||||
/// dependencies that are not *directly* used by this test module require an
|
/// dependencies that are not *directly* used by this test module require an
|
||||||
/// `extern crate` declaration.
|
/// `extern crate` declaration.
|
||||||
static EXTERN_FLAGS: SyncLazy<String> = SyncLazy::new(|| {
|
static EXTERN_FLAGS: LazyLock<String> = LazyLock::new(|| {
|
||||||
let current_exe_depinfo = {
|
let current_exe_depinfo = {
|
||||||
let mut path = env::current_exe().unwrap();
|
let mut path = env::current_exe().unwrap();
|
||||||
path.set_extension("d");
|
path.set_extension("d");
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#![allow(dead_code)] // see https://github.com/rust-lang/rust/issues/46379
|
#![allow(dead_code)] // see https://github.com/rust-lang/rust/issues/46379
|
||||||
|
|
||||||
use std::lazy::SyncLazy;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
pub static CARGO_CLIPPY_PATH: SyncLazy<PathBuf> = SyncLazy::new(|| {
|
pub static CARGO_CLIPPY_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
|
||||||
let mut path = std::env::current_exe().unwrap();
|
let mut path = std::env::current_exe().unwrap();
|
||||||
assert!(path.pop()); // deps
|
assert!(path.pop()); // deps
|
||||||
path.set_file_name("cargo-clippy");
|
path.set_file_name("cargo-clippy");
|
||||||
|
|
|
@ -56,7 +56,25 @@ LL | if s == "43" {
|
||||||
LL ~ return 43;
|
LL ~ return 43;
|
||||||
LL | }
|
LL | }
|
||||||
LL | s == "42"
|
LL | s == "42"
|
||||||
|
LL | } {
|
||||||
|
LL ~ return 45;
|
||||||
|
LL | }
|
||||||
|
LL | match s.len() {
|
||||||
|
LL ~ 10 => 2,
|
||||||
|
LL | 20 => {
|
||||||
...
|
...
|
||||||
|
LL | if foo() {
|
||||||
|
LL ~ return 20;
|
||||||
|
LL | }
|
||||||
|
LL | println!("foo");
|
||||||
|
LL ~ 3
|
||||||
|
LL | };
|
||||||
|
LL | }
|
||||||
|
LL ~ 20
|
||||||
|
LL | },
|
||||||
|
LL ~ 40 => 30,
|
||||||
|
LL ~ _ => 1,
|
||||||
|
|
|
||||||
|
|
||||||
error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
|
error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
|
||||||
--> $DIR/bind_instead_of_map_multipart.rs:61:13
|
--> $DIR/bind_instead_of_map_multipart.rs:61:13
|
||||||
|
|
|
@ -98,7 +98,8 @@ LL + id: e_id,
|
||||||
LL + name: "Player 1".to_string(),
|
LL + name: "Player 1".to_string(),
|
||||||
LL + some_data: vec![0x12, 0x34, 0x56, 0x78, 0x90],
|
LL + some_data: vec![0x12, 0x34, 0x56, 0x78, 0x90],
|
||||||
LL + };
|
LL + };
|
||||||
...
|
LL + process_data(pack);
|
||||||
|
|
|
||||||
|
|
||||||
error: all if blocks contain the same code at both the start and the end
|
error: all if blocks contain the same code at both the start and the end
|
||||||
--> $DIR/shared_at_top_and_bottom.rs:94:5
|
--> $DIR/shared_at_top_and_bottom.rs:94:5
|
||||||
|
|
|
@ -28,7 +28,8 @@ LL + v
|
||||||
LL + } else {
|
LL + } else {
|
||||||
LL + v2
|
LL + v2
|
||||||
LL + }
|
LL + }
|
||||||
...
|
LL + });
|
||||||
|
|
|
||||||
|
|
||||||
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:38:5
|
--> $DIR/entry.rs:38:5
|
||||||
|
@ -50,7 +51,8 @@ LL + v
|
||||||
LL + } else {
|
LL + } else {
|
||||||
LL + v2
|
LL + v2
|
||||||
LL + }
|
LL + }
|
||||||
...
|
LL + });
|
||||||
|
|
|
||||||
|
|
||||||
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:47:5
|
--> $DIR/entry.rs:47:5
|
||||||
|
@ -72,7 +74,9 @@ LL + e.insert(v);
|
||||||
LL + } else {
|
LL + } else {
|
||||||
LL + e.insert(v2);
|
LL + e.insert(v2);
|
||||||
LL + return;
|
LL + return;
|
||||||
...
|
LL + }
|
||||||
|
LL + }
|
||||||
|
|
|
||||||
|
|
||||||
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:57:5
|
--> $DIR/entry.rs:57:5
|
||||||
|
@ -111,7 +115,11 @@ LL + 1 if true => {
|
||||||
LL + v
|
LL + v
|
||||||
LL + },
|
LL + },
|
||||||
LL + _ => {
|
LL + _ => {
|
||||||
...
|
LL + v2
|
||||||
|
LL + },
|
||||||
|
LL + }
|
||||||
|
LL + });
|
||||||
|
|
|
||||||
|
|
||||||
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:75:5
|
--> $DIR/entry.rs:75:5
|
||||||
|
@ -133,7 +141,9 @@ LL + 0 => foo(),
|
||||||
LL + _ => {
|
LL + _ => {
|
||||||
LL + e.insert(v2);
|
LL + e.insert(v2);
|
||||||
LL + },
|
LL + },
|
||||||
...
|
LL + };
|
||||||
|
LL + }
|
||||||
|
|
|
||||||
|
|
||||||
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:85:5
|
--> $DIR/entry.rs:85:5
|
||||||
|
@ -155,7 +165,26 @@ LL + match 0 {
|
||||||
LL + 0 if false => {
|
LL + 0 if false => {
|
||||||
LL + v
|
LL + v
|
||||||
LL + },
|
LL + },
|
||||||
...
|
LL + 1 => {
|
||||||
|
LL + foo();
|
||||||
|
LL + v
|
||||||
|
LL + },
|
||||||
|
LL + 2 | 3 => {
|
||||||
|
LL + for _ in 0..2 {
|
||||||
|
LL + foo();
|
||||||
|
LL + }
|
||||||
|
LL + if true {
|
||||||
|
LL + v
|
||||||
|
LL + } else {
|
||||||
|
LL + v2
|
||||||
|
LL + }
|
||||||
|
LL + },
|
||||||
|
LL + _ => {
|
||||||
|
LL + v2
|
||||||
|
LL + },
|
||||||
|
LL + }
|
||||||
|
LL + });
|
||||||
|
|
|
||||||
|
|
||||||
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:119:5
|
--> $DIR/entry.rs:119:5
|
||||||
|
|
|
@ -17,7 +17,9 @@ LL + e.insert(v);
|
||||||
LL + }
|
LL + }
|
||||||
LL + std::collections::hash_map::Entry::Occupied(mut e) => {
|
LL + std::collections::hash_map::Entry::Occupied(mut e) => {
|
||||||
LL + e.insert(v2);
|
LL + e.insert(v2);
|
||||||
...
|
LL + }
|
||||||
|
LL + }
|
||||||
|
|
|
||||||
|
|
||||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||||
--> $DIR/entry_with_else.rs:22:5
|
--> $DIR/entry_with_else.rs:22:5
|
||||||
|
@ -37,7 +39,9 @@ LL + e.insert(v);
|
||||||
LL + }
|
LL + }
|
||||||
LL + std::collections::hash_map::Entry::Vacant(e) => {
|
LL + std::collections::hash_map::Entry::Vacant(e) => {
|
||||||
LL + e.insert(v2);
|
LL + e.insert(v2);
|
||||||
...
|
LL + }
|
||||||
|
LL + }
|
||||||
|
|
|
||||||
|
|
||||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||||
--> $DIR/entry_with_else.rs:28:5
|
--> $DIR/entry_with_else.rs:28:5
|
||||||
|
@ -95,7 +99,9 @@ LL + e.insert(v);
|
||||||
LL + }
|
LL + }
|
||||||
LL + std::collections::hash_map::Entry::Occupied(mut e) => {
|
LL + std::collections::hash_map::Entry::Occupied(mut e) => {
|
||||||
LL + e.insert(v2);
|
LL + e.insert(v2);
|
||||||
...
|
LL + }
|
||||||
|
LL + }
|
||||||
|
|
|
||||||
|
|
||||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||||
--> $DIR/entry_with_else.rs:46:5
|
--> $DIR/entry_with_else.rs:46:5
|
||||||
|
@ -115,7 +121,10 @@ LL + if true { Some(e.insert(v)) } else { Some(e.insert(v2)) }
|
||||||
LL + }
|
LL + }
|
||||||
LL + std::collections::hash_map::Entry::Vacant(e) => {
|
LL + std::collections::hash_map::Entry::Vacant(e) => {
|
||||||
LL + e.insert(v);
|
LL + e.insert(v);
|
||||||
...
|
LL + None
|
||||||
|
LL + }
|
||||||
|
LL ~ };
|
||||||
|
|
|
||||||
|
|
||||||
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
|
||||||
--> $DIR/entry_with_else.rs:52:5
|
--> $DIR/entry_with_else.rs:52:5
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("Hello/n");
|
LL - eprint!("Hello/n");
|
||||||
LL + eprintln!("Hello");
|
LL + eprintln!("Hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `eprint!()` with a format string that ends in a single newline
|
error: using `eprint!()` with a format string that ends in a single newline
|
||||||
--> $DIR/eprint_with_newline.rs:6:5
|
--> $DIR/eprint_with_newline.rs:6:5
|
||||||
|
@ -21,7 +21,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("Hello {}/n", "world");
|
LL - eprint!("Hello {}/n", "world");
|
||||||
LL + eprintln!("Hello {}", "world");
|
LL + eprintln!("Hello {}", "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `eprint!()` with a format string that ends in a single newline
|
error: using `eprint!()` with a format string that ends in a single newline
|
||||||
--> $DIR/eprint_with_newline.rs:7:5
|
--> $DIR/eprint_with_newline.rs:7:5
|
||||||
|
@ -33,7 +33,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("Hello {} {}/n", "world", "#2");
|
LL - eprint!("Hello {} {}/n", "world", "#2");
|
||||||
LL + eprintln!("Hello {} {}", "world", "#2");
|
LL + eprintln!("Hello {} {}", "world", "#2");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `eprint!()` with a format string that ends in a single newline
|
error: using `eprint!()` with a format string that ends in a single newline
|
||||||
--> $DIR/eprint_with_newline.rs:8:5
|
--> $DIR/eprint_with_newline.rs:8:5
|
||||||
|
@ -45,7 +45,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("{}/n", 1265);
|
LL - eprint!("{}/n", 1265);
|
||||||
LL + eprintln!("{}", 1265);
|
LL + eprintln!("{}", 1265);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `eprint!()` with a format string that ends in a single newline
|
error: using `eprint!()` with a format string that ends in a single newline
|
||||||
--> $DIR/eprint_with_newline.rs:9:5
|
--> $DIR/eprint_with_newline.rs:9:5
|
||||||
|
@ -57,7 +57,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("/n");
|
LL - eprint!("/n");
|
||||||
LL + eprintln!();
|
LL + eprintln!();
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `eprint!()` with a format string that ends in a single newline
|
error: using `eprint!()` with a format string that ends in a single newline
|
||||||
--> $DIR/eprint_with_newline.rs:28:5
|
--> $DIR/eprint_with_newline.rs:28:5
|
||||||
|
@ -69,7 +69,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("//n"); // should fail
|
LL - eprint!("//n"); // should fail
|
||||||
LL + eprintln!("/"); // should fail
|
LL + eprintln!("/"); // should fail
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `eprint!()` with a format string that ends in a single newline
|
error: using `eprint!()` with a format string that ends in a single newline
|
||||||
--> $DIR/eprint_with_newline.rs:35:5
|
--> $DIR/eprint_with_newline.rs:35:5
|
||||||
|
@ -111,7 +111,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("/r/n"); //~ ERROR
|
LL - eprint!("/r/n"); //~ ERROR
|
||||||
LL + eprintln!("/r"); //~ ERROR
|
LL + eprintln!("/r"); //~ ERROR
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `eprint!()` with a format string that ends in a single newline
|
error: using `eprint!()` with a format string that ends in a single newline
|
||||||
--> $DIR/eprint_with_newline.rs:48:5
|
--> $DIR/eprint_with_newline.rs:48:5
|
||||||
|
@ -123,7 +123,7 @@ help: use `eprintln!` instead
|
||||||
|
|
|
|
||||||
LL - eprint!("foo/rbar/n") // ~ ERROR
|
LL - eprint!("foo/rbar/n") // ~ ERROR
|
||||||
LL + eprintln!("foo/rbar") // ~ ERROR
|
LL + eprintln!("foo/rbar") // ~ ERROR
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@ LL + .map(|i| i * 2)
|
||||||
LL + .filter(|i| i % 2 == 0)
|
LL + .filter(|i| i % 2 == 0)
|
||||||
LL + .map(|_| ())
|
LL + .map(|_| ())
|
||||||
LL + .next()
|
LL + .next()
|
||||||
...
|
LL + .unwrap();
|
||||||
|
|
|
||||||
|
|
||||||
error: this let-binding has unit value
|
error: this let-binding has unit value
|
||||||
--> $DIR/let_unit.rs:80:5
|
--> $DIR/let_unit.rs:80:5
|
||||||
|
|
|
@ -122,7 +122,14 @@ LL + let a = 42;
|
||||||
LL + let b = 21;
|
LL + let b = 21;
|
||||||
LL + if a < b {
|
LL + if a < b {
|
||||||
LL + let c = 21;
|
LL + let c = 21;
|
||||||
...
|
LL + let d = 42;
|
||||||
|
LL + if c < d {
|
||||||
|
LL + let _ = 42;
|
||||||
|
LL + }
|
||||||
|
LL + }
|
||||||
|
LL + 42
|
||||||
|
LL + }
|
||||||
|
|
|
||||||
|
|
||||||
error: this function can be simplified using the `async fn` syntax
|
error: this function can be simplified using the `async fn` syntax
|
||||||
--> $DIR/manual_async_fn.rs:92:1
|
--> $DIR/manual_async_fn.rs:92:1
|
||||||
|
|
|
@ -96,12 +96,12 @@ help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let l = iter.next().unwrap();
|
LL - let l = iter.next().unwrap();
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
help: remove the `iter` usages
|
help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let r = iter.next().unwrap();
|
LL - let r = iter.next().unwrap();
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
|
|
||||||
error: manual implementation of `split_once`
|
error: manual implementation of `split_once`
|
||||||
--> $DIR/manual_split_once.rs:49:5
|
--> $DIR/manual_split_once.rs:49:5
|
||||||
|
@ -121,12 +121,12 @@ help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let l = iter.next()?;
|
LL - let l = iter.next()?;
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
help: remove the `iter` usages
|
help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let r = iter.next()?;
|
LL - let r = iter.next()?;
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
|
|
||||||
error: manual implementation of `rsplit_once`
|
error: manual implementation of `rsplit_once`
|
||||||
--> $DIR/manual_split_once.rs:53:5
|
--> $DIR/manual_split_once.rs:53:5
|
||||||
|
@ -146,12 +146,12 @@ help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let r = iter.next().unwrap();
|
LL - let r = iter.next().unwrap();
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
help: remove the `iter` usages
|
help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let l = iter.next().unwrap();
|
LL - let l = iter.next().unwrap();
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
|
|
||||||
error: manual implementation of `rsplit_once`
|
error: manual implementation of `rsplit_once`
|
||||||
--> $DIR/manual_split_once.rs:57:5
|
--> $DIR/manual_split_once.rs:57:5
|
||||||
|
@ -171,12 +171,12 @@ help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let r = iter.next()?;
|
LL - let r = iter.next()?;
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
help: remove the `iter` usages
|
help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let l = iter.next()?;
|
LL - let l = iter.next()?;
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
|
|
||||||
error: manual implementation of `split_once`
|
error: manual implementation of `split_once`
|
||||||
--> $DIR/manual_split_once.rs:142:13
|
--> $DIR/manual_split_once.rs:142:13
|
||||||
|
@ -202,12 +202,12 @@ help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let a = iter.next().unwrap();
|
LL - let a = iter.next().unwrap();
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
help: remove the `iter` usages
|
help: remove the `iter` usages
|
||||||
|
|
|
|
||||||
LL - let b = iter.next().unwrap();
|
LL - let b = iter.next().unwrap();
|
||||||
LL +
|
LL +
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 19 previous errors
|
error: aborting due to 19 previous errors
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,12 @@ LL | | .flatten();
|
||||||
| |__________________^
|
| |__________________^
|
||||||
|
|
|
|
||||||
= note: `-D clippy::map-flatten` implied by `-D warnings`
|
= note: `-D clippy::map-flatten` implied by `-D warnings`
|
||||||
help: try replacing `map` with `and_then`
|
help: try replacing `map` with `and_then` and remove the `.flatten()`
|
||||||
|
|
|
|
||||||
LL ~ .and_then(|x| {
|
LL ~ .and_then(|x| {
|
||||||
LL + if x <= 5 {
|
LL + if x <= 5 {
|
||||||
LL + Some(x)
|
LL + Some(x)
|
||||||
|
|
LL + } else {
|
||||||
help: and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL + None
|
LL + None
|
||||||
LL + }
|
LL + }
|
||||||
LL ~ });
|
LL ~ });
|
||||||
|
@ -38,14 +36,12 @@ LL | | })
|
||||||
LL | | .flatten();
|
LL | | .flatten();
|
||||||
| |__________________^
|
| |__________________^
|
||||||
|
|
|
|
||||||
help: try replacing `map` with `and_then`
|
help: try replacing `map` with `and_then` and remove the `.flatten()`
|
||||||
|
|
|
|
||||||
LL ~ .and_then(|x| {
|
LL ~ .and_then(|x| {
|
||||||
LL + if x == 1 {
|
LL + if x == 1 {
|
||||||
LL + Ok(x)
|
LL + Ok(x)
|
||||||
|
|
LL + } else {
|
||||||
help: and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL + Err(0)
|
LL + Err(0)
|
||||||
LL + }
|
LL + }
|
||||||
LL ~ });
|
LL ~ });
|
||||||
|
@ -64,14 +60,13 @@ LL | | })
|
||||||
LL | | .flatten();
|
LL | | .flatten();
|
||||||
| |__________________^
|
| |__________________^
|
||||||
|
|
|
|
||||||
help: try replacing `map` with `and_then`
|
help: try replacing `map` with `and_then` and remove the `.flatten()`
|
||||||
|
|
|
|
||||||
LL ~ .and_then(|res| {
|
LL ~ .and_then(|res| {
|
||||||
LL + if res > 0 {
|
LL + if res > 0 {
|
||||||
LL + do_something();
|
LL + do_something();
|
||||||
|
|
LL + Ok(res)
|
||||||
help: and remove the `.flatten()`
|
LL + } else {
|
||||||
|
|
|
||||||
LL + Err(0)
|
LL + Err(0)
|
||||||
LL + }
|
LL + }
|
||||||
LL ~ });
|
LL ~ });
|
||||||
|
@ -90,14 +85,12 @@ LL | | })
|
||||||
LL | | .flatten()
|
LL | | .flatten()
|
||||||
| |__________________^
|
| |__________________^
|
||||||
|
|
|
|
||||||
help: try replacing `map` with `filter_map`
|
help: try replacing `map` with `filter_map` and remove the `.flatten()`
|
||||||
|
|
|
|
||||||
LL ~ .filter_map(|some_value| {
|
LL ~ .filter_map(|some_value| {
|
||||||
LL + if some_value > 3 {
|
LL + if some_value > 3 {
|
||||||
LL + Some(some_value)
|
LL + Some(some_value)
|
||||||
|
|
LL + } else {
|
||||||
help: and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL + None
|
LL + None
|
||||||
LL + }
|
LL + }
|
||||||
LL + })
|
LL + })
|
||||||
|
|
|
@ -59,8 +59,6 @@ fn issue8878() {
|
||||||
.and_then(|_| {
|
.and_then(|_| {
|
||||||
// we need some newlines
|
// we need some newlines
|
||||||
// so that the span is big enough
|
// so that the span is big enough
|
||||||
// we need some newlines
|
|
||||||
// so that the span is big enough
|
|
||||||
// for a splitted output of the diagnostic
|
// for a splitted output of the diagnostic
|
||||||
Some("")
|
Some("")
|
||||||
// whitespace beforehand is important as well
|
// whitespace beforehand is important as well
|
||||||
|
|
|
@ -2,79 +2,45 @@ error: called `map(..).flatten()` on `Iterator`
|
||||||
--> $DIR/map_flatten_fixable.rs:18:47
|
--> $DIR/map_flatten_fixable.rs:18:47
|
||||||
|
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect();
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id)`
|
||||||
|
|
|
|
||||||
= note: `-D clippy::map-flatten` implied by `-D warnings`
|
= note: `-D clippy::map-flatten` implied by `-D warnings`
|
||||||
help: try replacing `map` with `filter_map`, and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id).collect();
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: called `map(..).flatten()` on `Iterator`
|
error: called `map(..).flatten()` on `Iterator`
|
||||||
--> $DIR/map_flatten_fixable.rs:19:47
|
--> $DIR/map_flatten_fixable.rs:19:47
|
||||||
|
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_ref)`
|
||||||
|
|
|
||||||
help: try replacing `map` with `filter_map`, and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_ref).collect();
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: called `map(..).flatten()` on `Iterator`
|
error: called `map(..).flatten()` on `Iterator`
|
||||||
--> $DIR/map_flatten_fixable.rs:20:47
|
--> $DIR/map_flatten_fixable.rs:20:47
|
||||||
|
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_closure)`
|
||||||
|
|
|
||||||
help: try replacing `map` with `filter_map`, and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(option_id_closure).collect();
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: called `map(..).flatten()` on `Iterator`
|
error: called `map(..).flatten()` on `Iterator`
|
||||||
--> $DIR/map_flatten_fixable.rs:21:47
|
--> $DIR/map_flatten_fixable.rs:21:47
|
||||||
|
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(|x| x.checked_add(1))`
|
||||||
|
|
|
||||||
help: try replacing `map` with `filter_map`, and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().filter_map(|x| x.checked_add(1)).collect();
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: called `map(..).flatten()` on `Iterator`
|
error: called `map(..).flatten()` on `Iterator`
|
||||||
--> $DIR/map_flatten_fixable.rs:24:47
|
--> $DIR/map_flatten_fixable.rs:24:47
|
||||||
|
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
|
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|x| 0..x)`
|
||||||
|
|
|
||||||
help: try replacing `map` with `flat_map`, and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().flat_map(|x| 0..x).collect();
|
|
||||||
| ~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: called `map(..).flatten()` on `Option`
|
error: called `map(..).flatten()` on `Option`
|
||||||
--> $DIR/map_flatten_fixable.rs:27:40
|
--> $DIR/map_flatten_fixable.rs:27:40
|
||||||
|
|
|
|
||||||
LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
|
LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)`
|
||||||
|
|
|
||||||
help: try replacing `map` with `and_then`, and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL | let _: Option<_> = (Some(Some(1))).and_then(|x| x);
|
|
||||||
| ~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: called `map(..).flatten()` on `Result`
|
error: called `map(..).flatten()` on `Result`
|
||||||
--> $DIR/map_flatten_fixable.rs:30:42
|
--> $DIR/map_flatten_fixable.rs:30:42
|
||||||
|
|
|
|
||||||
LL | let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten();
|
LL | let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)`
|
||||||
|
|
|
||||||
help: try replacing `map` with `and_then`, and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL | let _: Result<_, &str> = (Ok(Ok(1))).and_then(|x| x);
|
|
||||||
| ~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: called `map(..).flatten()` on `Option`
|
error: called `map(..).flatten()` on `Option`
|
||||||
--> $DIR/map_flatten_fixable.rs:59:10
|
--> $DIR/map_flatten_fixable.rs:59:10
|
||||||
|
@ -89,14 +55,12 @@ LL | | })
|
||||||
LL | | .flatten();
|
LL | | .flatten();
|
||||||
| |__________________^
|
| |__________________^
|
||||||
|
|
|
|
||||||
help: try replacing `map` with `and_then`
|
help: try replacing `map` with `and_then` and remove the `.flatten()`
|
||||||
|
|
|
|
||||||
LL ~ .and_then(|_| {
|
LL ~ .and_then(|_| {
|
||||||
LL + // we need some newlines
|
LL + // we need some newlines
|
||||||
LL + // so that the span is big enough
|
LL + // so that the span is big enough
|
||||||
|
|
LL + // for a splitted output of the diagnostic
|
||||||
help: and remove the `.flatten()`
|
|
||||||
|
|
|
||||||
LL + Some("")
|
LL + Some("")
|
||||||
LL + // whitespace beforehand is important as well
|
LL + // whitespace beforehand is important as well
|
||||||
LL ~ });
|
LL ~ });
|
||||||
|
|
|
@ -12,7 +12,7 @@ help: use `map_or(<a>, <f>)` instead
|
||||||
|
|
|
|
||||||
LL - let _ = opt.map(|x| x + 1)
|
LL - let _ = opt.map(|x| x + 1)
|
||||||
LL + let _ = opt.map_or(0, |x| x + 1);
|
LL + let _ = opt.map_or(0, |x| x + 1);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
|
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
|
||||||
--> $DIR/map_unwrap_or.rs:20:13
|
--> $DIR/map_unwrap_or.rs:20:13
|
||||||
|
@ -59,7 +59,7 @@ help: use `and_then(<f>)` instead
|
||||||
|
|
|
|
||||||
LL - let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
|
LL - let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
|
||||||
LL + let _ = opt.and_then(|x| Some(x + 1));
|
LL + let _ = opt.and_then(|x| Some(x + 1));
|
||||||
|
|
|
|
||||||
|
|
||||||
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
|
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
|
||||||
--> $DIR/map_unwrap_or.rs:31:13
|
--> $DIR/map_unwrap_or.rs:31:13
|
||||||
|
@ -92,7 +92,7 @@ help: use `and_then(<f>)` instead
|
||||||
|
|
|
|
||||||
LL - .map(|x| Some(x + 1))
|
LL - .map(|x| Some(x + 1))
|
||||||
LL + .and_then(|x| Some(x + 1));
|
LL + .and_then(|x| Some(x + 1));
|
||||||
|
|
|
|
||||||
|
|
||||||
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
|
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
|
||||||
--> $DIR/map_unwrap_or.rs:46:13
|
--> $DIR/map_unwrap_or.rs:46:13
|
||||||
|
@ -104,7 +104,7 @@ help: use `map_or(<a>, <f>)` instead
|
||||||
|
|
|
|
||||||
LL - let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
|
LL - let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
|
||||||
LL + let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
|
LL + let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
|
||||||
|
|
|
|
||||||
|
|
||||||
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
|
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
|
||||||
--> $DIR/map_unwrap_or.rs:50:13
|
--> $DIR/map_unwrap_or.rs:50:13
|
||||||
|
|
|
@ -19,7 +19,8 @@ LL + return;
|
||||||
LL + } else {
|
LL + } else {
|
||||||
LL + println!("{}", v);
|
LL + println!("{}", v);
|
||||||
LL + }
|
LL + }
|
||||||
...
|
LL + }
|
||||||
|
|
|
||||||
help: ...and replace `return` with `continue`
|
help: ...and replace `return` with `continue`
|
||||||
|
|
|
|
||||||
LL | continue;
|
LL | continue;
|
||||||
|
|
|
@ -164,7 +164,7 @@ help: remove the assignments from the `match` arms
|
||||||
|
|
|
|
||||||
LL - 1 => f = "three",
|
LL - 1 => f = "three",
|
||||||
LL + 1 => "three",
|
LL + 1 => "three",
|
||||||
|
|
|
|
||||||
|
|
||||||
error: unneeded late initialization
|
error: unneeded late initialization
|
||||||
--> $DIR/needless_late_init.rs:76:5
|
--> $DIR/needless_late_init.rs:76:5
|
||||||
|
@ -180,7 +180,7 @@ help: remove the assignments from the branches
|
||||||
|
|
|
|
||||||
LL - g = 5;
|
LL - g = 5;
|
||||||
LL + 5
|
LL + 5
|
||||||
|
|
|
|
||||||
help: add a semicolon after the `if` expression
|
help: add a semicolon after the `if` expression
|
||||||
|
|
|
|
||||||
LL | };
|
LL | };
|
||||||
|
|
|
@ -117,7 +117,8 @@ LL + Self::new()
|
||||||
LL + }
|
LL + }
|
||||||
LL + }
|
LL + }
|
||||||
LL +
|
LL +
|
||||||
...
|
LL ~ impl<T> Foo<T> {
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 7 previous errors
|
error: aborting due to 7 previous errors
|
||||||
|
|
||||||
|
|
|
@ -185,8 +185,7 @@ mod issue8239 {
|
||||||
.reduce(|mut acc, f| {
|
.reduce(|mut acc, f| {
|
||||||
acc.push_str(&f);
|
acc.push_str(&f);
|
||||||
acc
|
acc
|
||||||
})
|
}).unwrap_or_default();
|
||||||
.unwrap_or_default();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn more_to_max_suggestion_highest_lines_1() {
|
fn more_to_max_suggestion_highest_lines_1() {
|
||||||
|
@ -198,8 +197,7 @@ mod issue8239 {
|
||||||
let _ = "";
|
let _ = "";
|
||||||
acc.push_str(&f);
|
acc.push_str(&f);
|
||||||
acc
|
acc
|
||||||
})
|
}).unwrap_or_default();
|
||||||
.unwrap_or_default();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn equal_to_max_suggestion_highest_lines() {
|
fn equal_to_max_suggestion_highest_lines() {
|
||||||
|
|
|
@ -109,16 +109,50 @@ LL | None.unwrap_or( unsafe { ptr_to_ref(s) } );
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
|
||||||
|
|
||||||
error: use of `unwrap_or` followed by a call to `new`
|
error: use of `unwrap_or` followed by a call to `new`
|
||||||
--> $DIR/or_fun_call.rs:189:14
|
--> $DIR/or_fun_call.rs:182:9
|
||||||
|
|
|
||||||
|
LL | / frames
|
||||||
|
LL | | .iter()
|
||||||
|
LL | | .map(|f: &String| f.to_lowercase())
|
||||||
|
LL | | .reduce(|mut acc, f| {
|
||||||
|
... |
|
||||||
|
LL | | })
|
||||||
|
LL | | .unwrap_or(String::new());
|
||||||
|
| |_____________________________________^
|
||||||
|
|
|
||||||
|
help: try this
|
||||||
|
|
|
||||||
|
LL ~ frames
|
||||||
|
LL + .iter()
|
||||||
|
LL + .map(|f: &String| f.to_lowercase())
|
||||||
|
LL + .reduce(|mut acc, f| {
|
||||||
|
LL + acc.push_str(&f);
|
||||||
|
LL + acc
|
||||||
|
LL ~ }).unwrap_or_default();
|
||||||
|
|
|
|
||||||
LL | .unwrap_or(String::new());
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
|
||||||
|
|
||||||
error: use of `unwrap_or` followed by a call to `new`
|
error: use of `unwrap_or` followed by a call to `new`
|
||||||
--> $DIR/or_fun_call.rs:202:14
|
--> $DIR/or_fun_call.rs:195:9
|
||||||
|
|
|
||||||
|
LL | / iter.map(|f: &String| f.to_lowercase())
|
||||||
|
LL | | .reduce(|mut acc, f| {
|
||||||
|
LL | | let _ = "";
|
||||||
|
LL | | let _ = "";
|
||||||
|
... |
|
||||||
|
LL | | })
|
||||||
|
LL | | .unwrap_or(String::new());
|
||||||
|
| |_____________________________________^
|
||||||
|
|
|
||||||
|
help: try this
|
||||||
|
|
|
||||||
|
LL ~ iter.map(|f: &String| f.to_lowercase())
|
||||||
|
LL + .reduce(|mut acc, f| {
|
||||||
|
LL + let _ = "";
|
||||||
|
LL + let _ = "";
|
||||||
|
LL + acc.push_str(&f);
|
||||||
|
LL + acc
|
||||||
|
LL ~ }).unwrap_or_default();
|
||||||
|
|
|
|
||||||
LL | .unwrap_or(String::new());
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
|
||||||
|
|
||||||
error: use of `unwrap_or` followed by a call to `new`
|
error: use of `unwrap_or` followed by a call to `new`
|
||||||
--> $DIR/or_fun_call.rs:208:9
|
--> $DIR/or_fun_call.rs:208:9
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - print!("Hello {}", "world");
|
LL - print!("Hello {}", "world");
|
||||||
LL + print!("Hello world");
|
LL + print!("Hello world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:26:36
|
--> $DIR/print_literal.rs:26:36
|
||||||
|
@ -21,7 +21,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("Hello {} {}", world, "world");
|
LL - println!("Hello {} {}", world, "world");
|
||||||
LL + println!("Hello {} world", world);
|
LL + println!("Hello {} world", world);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:27:26
|
--> $DIR/print_literal.rs:27:26
|
||||||
|
@ -33,7 +33,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("Hello {}", "world");
|
LL - println!("Hello {}", "world");
|
||||||
LL + println!("Hello world");
|
LL + println!("Hello world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:32:25
|
--> $DIR/print_literal.rs:32:25
|
||||||
|
@ -45,7 +45,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{0} {1}", "hello", "world");
|
LL - println!("{0} {1}", "hello", "world");
|
||||||
LL + println!("hello {1}", "world");
|
LL + println!("hello {1}", "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:32:34
|
--> $DIR/print_literal.rs:32:34
|
||||||
|
@ -57,7 +57,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{0} {1}", "hello", "world");
|
LL - println!("{0} {1}", "hello", "world");
|
||||||
LL + println!("{0} world", "hello");
|
LL + println!("{0} world", "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:33:25
|
--> $DIR/print_literal.rs:33:25
|
||||||
|
@ -69,7 +69,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{1} {0}", "hello", "world");
|
LL - println!("{1} {0}", "hello", "world");
|
||||||
LL + println!("{1} hello", "world");
|
LL + println!("{1} hello", "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:33:34
|
--> $DIR/print_literal.rs:33:34
|
||||||
|
@ -81,7 +81,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{1} {0}", "hello", "world");
|
LL - println!("{1} {0}", "hello", "world");
|
||||||
LL + println!("world {0}", "hello");
|
LL + println!("world {0}", "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:36:29
|
--> $DIR/print_literal.rs:36:29
|
||||||
|
@ -93,7 +93,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{foo} {bar}", foo = "hello", bar = "world");
|
LL - println!("{foo} {bar}", foo = "hello", bar = "world");
|
||||||
LL + println!("hello {bar}", bar = "world");
|
LL + println!("hello {bar}", bar = "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:36:44
|
--> $DIR/print_literal.rs:36:44
|
||||||
|
@ -105,7 +105,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{foo} {bar}", foo = "hello", bar = "world");
|
LL - println!("{foo} {bar}", foo = "hello", bar = "world");
|
||||||
LL + println!("{foo} world", foo = "hello");
|
LL + println!("{foo} world", foo = "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:37:29
|
--> $DIR/print_literal.rs:37:29
|
||||||
|
@ -117,7 +117,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{bar} {foo}", foo = "hello", bar = "world");
|
LL - println!("{bar} {foo}", foo = "hello", bar = "world");
|
||||||
LL + println!("{bar} hello", bar = "world");
|
LL + println!("{bar} hello", bar = "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/print_literal.rs:37:44
|
--> $DIR/print_literal.rs:37:44
|
||||||
|
@ -129,7 +129,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - println!("{bar} {foo}", foo = "hello", bar = "world");
|
LL - println!("{bar} {foo}", foo = "hello", bar = "world");
|
||||||
LL + println!("world {foo}", foo = "hello");
|
LL + println!("world {foo}", foo = "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 11 previous errors
|
error: aborting due to 11 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("Hello/n");
|
LL - print!("Hello/n");
|
||||||
LL + println!("Hello");
|
LL + println!("Hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `print!()` with a format string that ends in a single newline
|
error: using `print!()` with a format string that ends in a single newline
|
||||||
--> $DIR/print_with_newline.rs:9:5
|
--> $DIR/print_with_newline.rs:9:5
|
||||||
|
@ -21,7 +21,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("Hello {}/n", "world");
|
LL - print!("Hello {}/n", "world");
|
||||||
LL + println!("Hello {}", "world");
|
LL + println!("Hello {}", "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `print!()` with a format string that ends in a single newline
|
error: using `print!()` with a format string that ends in a single newline
|
||||||
--> $DIR/print_with_newline.rs:10:5
|
--> $DIR/print_with_newline.rs:10:5
|
||||||
|
@ -33,7 +33,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("Hello {} {}/n", "world", "#2");
|
LL - print!("Hello {} {}/n", "world", "#2");
|
||||||
LL + println!("Hello {} {}", "world", "#2");
|
LL + println!("Hello {} {}", "world", "#2");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `print!()` with a format string that ends in a single newline
|
error: using `print!()` with a format string that ends in a single newline
|
||||||
--> $DIR/print_with_newline.rs:11:5
|
--> $DIR/print_with_newline.rs:11:5
|
||||||
|
@ -45,7 +45,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("{}/n", 1265);
|
LL - print!("{}/n", 1265);
|
||||||
LL + println!("{}", 1265);
|
LL + println!("{}", 1265);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `print!()` with a format string that ends in a single newline
|
error: using `print!()` with a format string that ends in a single newline
|
||||||
--> $DIR/print_with_newline.rs:12:5
|
--> $DIR/print_with_newline.rs:12:5
|
||||||
|
@ -57,7 +57,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("/n");
|
LL - print!("/n");
|
||||||
LL + println!();
|
LL + println!();
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `print!()` with a format string that ends in a single newline
|
error: using `print!()` with a format string that ends in a single newline
|
||||||
--> $DIR/print_with_newline.rs:31:5
|
--> $DIR/print_with_newline.rs:31:5
|
||||||
|
@ -69,7 +69,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("//n"); // should fail
|
LL - print!("//n"); // should fail
|
||||||
LL + println!("/"); // should fail
|
LL + println!("/"); // should fail
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `print!()` with a format string that ends in a single newline
|
error: using `print!()` with a format string that ends in a single newline
|
||||||
--> $DIR/print_with_newline.rs:38:5
|
--> $DIR/print_with_newline.rs:38:5
|
||||||
|
@ -111,7 +111,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("/r/n"); //~ ERROR
|
LL - print!("/r/n"); //~ ERROR
|
||||||
LL + println!("/r"); //~ ERROR
|
LL + println!("/r"); //~ ERROR
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `print!()` with a format string that ends in a single newline
|
error: using `print!()` with a format string that ends in a single newline
|
||||||
--> $DIR/print_with_newline.rs:51:5
|
--> $DIR/print_with_newline.rs:51:5
|
||||||
|
@ -123,7 +123,7 @@ help: use `println!` instead
|
||||||
|
|
|
|
||||||
LL - print!("foo/rbar/n") // ~ ERROR
|
LL - print!("foo/rbar/n") // ~ ERROR
|
||||||
LL + println!("foo/rbar") // ~ ERROR
|
LL + println!("foo/rbar") // ~ ERROR
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ LL | let f = e.clone(); // OK
|
||||||
LL | let g = x;
|
LL | let g = x;
|
||||||
LL ~ let h = g.to_owned();
|
LL ~ let h = g.to_owned();
|
||||||
LL | let i = (e).clone();
|
LL | let i = (e).clone();
|
||||||
...
|
LL ~ x.to_owned()
|
||||||
|
|
|
||||||
|
|
||||||
error: writing `&String` instead of `&str` involves a new object where a slice will do
|
error: writing `&String` instead of `&str` involves a new object where a slice will do
|
||||||
--> $DIR/ptr_arg.rs:58:18
|
--> $DIR/ptr_arg.rs:58:18
|
||||||
|
|
|
@ -311,7 +311,9 @@ LL + _ => mutex2.lock().unwrap(),
|
||||||
LL + }
|
LL + }
|
||||||
LL + .s
|
LL + .s
|
||||||
LL + .len()
|
LL + .len()
|
||||||
...
|
LL + > 1;
|
||||||
|
LL ~ match value
|
||||||
|
|
|
||||||
|
|
||||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||||
--> $DIR/significant_drop_in_scrutinee.rs:410:11
|
--> $DIR/significant_drop_in_scrutinee.rs:410:11
|
||||||
|
@ -341,7 +343,10 @@ LL + } else {
|
||||||
LL + mutex2.lock().unwrap()
|
LL + mutex2.lock().unwrap()
|
||||||
LL + }
|
LL + }
|
||||||
LL + .s
|
LL + .s
|
||||||
...
|
LL + .len()
|
||||||
|
LL + > 1;
|
||||||
|
LL ~ match value
|
||||||
|
|
|
||||||
|
|
||||||
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
|
||||||
--> $DIR/significant_drop_in_scrutinee.rs:464:11
|
--> $DIR/significant_drop_in_scrutinee.rs:464:11
|
||||||
|
|
|
@ -137,7 +137,13 @@ LL + foo(1);
|
||||||
LL + };
|
LL + };
|
||||||
LL + {
|
LL + {
|
||||||
LL + foo(2);
|
LL + foo(2);
|
||||||
...
|
LL + foo(3);
|
||||||
|
LL + };
|
||||||
|
LL + taking_multiple_units(
|
||||||
|
LL + (),
|
||||||
|
LL + (),
|
||||||
|
LL ~ );
|
||||||
|
|
|
||||||
|
|
||||||
error: passing a unit value to a function
|
error: passing a unit value to a function
|
||||||
--> $DIR/unit_arg.rs:85:13
|
--> $DIR/unit_arg.rs:85:13
|
||||||
|
|
|
@ -13,7 +13,7 @@ help: remove this `&`
|
||||||
|
|
|
|
||||||
LL - let other = match get_file_path(&t) {
|
LL - let other = match get_file_path(&t) {
|
||||||
LL + let other = match get_file_path(t) {
|
LL + let other = match get_file_path(t) {
|
||||||
|
|
|
|
||||||
|
|
||||||
error: unnecessary use of `copied`
|
error: unnecessary use of `copied`
|
||||||
--> $DIR/unnecessary_iter_cloned.rs:46:22
|
--> $DIR/unnecessary_iter_cloned.rs:46:22
|
||||||
|
@ -29,7 +29,7 @@ help: remove this `&`
|
||||||
|
|
|
|
||||||
LL - let other = match get_file_path(&t) {
|
LL - let other = match get_file_path(&t) {
|
||||||
LL + let other = match get_file_path(t) {
|
LL + let other = match get_file_path(t) {
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -489,7 +489,7 @@ help: remove this `&`
|
||||||
|
|
|
|
||||||
LL - let path = match get_file_path(&t) {
|
LL - let path = match get_file_path(&t) {
|
||||||
LL + let path = match get_file_path(t) {
|
LL + let path = match get_file_path(t) {
|
||||||
|
|
|
|
||||||
|
|
||||||
error: unnecessary use of `to_vec`
|
error: unnecessary use of `to_vec`
|
||||||
--> $DIR/unnecessary_to_owned.rs:221:14
|
--> $DIR/unnecessary_to_owned.rs:221:14
|
||||||
|
|
|
@ -23,7 +23,8 @@ LL | if a {
|
||||||
LL | Some(-1);
|
LL | Some(-1);
|
||||||
LL ~ 2
|
LL ~ 2
|
||||||
LL | } else {
|
LL | } else {
|
||||||
...
|
LL ~ return 1337;
|
||||||
|
|
|
||||||
|
|
||||||
error: this function's return value is unnecessarily wrapped by `Option`
|
error: this function's return value is unnecessarily wrapped by `Option`
|
||||||
--> $DIR/unnecessary_wraps.rs:21:1
|
--> $DIR/unnecessary_wraps.rs:21:1
|
||||||
|
@ -122,7 +123,8 @@ LL | if a {
|
||||||
LL | Some(());
|
LL | Some(());
|
||||||
LL ~
|
LL ~
|
||||||
LL | } else {
|
LL | } else {
|
||||||
...
|
LL ~ return ;
|
||||||
|
|
|
||||||
|
|
||||||
error: this function's return value is unnecessary
|
error: this function's return value is unnecessary
|
||||||
--> $DIR/unnecessary_wraps.rs:117:1
|
--> $DIR/unnecessary_wraps.rs:117:1
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - write!(v, "Hello {}", "world");
|
LL - write!(v, "Hello {}", "world");
|
||||||
LL + write!(v, "Hello world");
|
LL + write!(v, "Hello world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:31:39
|
--> $DIR/write_literal.rs:31:39
|
||||||
|
@ -21,7 +21,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "Hello {} {}", world, "world");
|
LL - writeln!(v, "Hello {} {}", world, "world");
|
||||||
LL + writeln!(v, "Hello {} world", world);
|
LL + writeln!(v, "Hello {} world", world);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:32:29
|
--> $DIR/write_literal.rs:32:29
|
||||||
|
@ -33,7 +33,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "Hello {}", "world");
|
LL - writeln!(v, "Hello {}", "world");
|
||||||
LL + writeln!(v, "Hello world");
|
LL + writeln!(v, "Hello world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:37:28
|
--> $DIR/write_literal.rs:37:28
|
||||||
|
@ -45,7 +45,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{0} {1}", "hello", "world");
|
LL - writeln!(v, "{0} {1}", "hello", "world");
|
||||||
LL + writeln!(v, "hello {1}", "world");
|
LL + writeln!(v, "hello {1}", "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:37:37
|
--> $DIR/write_literal.rs:37:37
|
||||||
|
@ -57,7 +57,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{0} {1}", "hello", "world");
|
LL - writeln!(v, "{0} {1}", "hello", "world");
|
||||||
LL + writeln!(v, "{0} world", "hello");
|
LL + writeln!(v, "{0} world", "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:38:28
|
--> $DIR/write_literal.rs:38:28
|
||||||
|
@ -69,7 +69,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{1} {0}", "hello", "world");
|
LL - writeln!(v, "{1} {0}", "hello", "world");
|
||||||
LL + writeln!(v, "{1} hello", "world");
|
LL + writeln!(v, "{1} hello", "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:38:37
|
--> $DIR/write_literal.rs:38:37
|
||||||
|
@ -81,7 +81,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{1} {0}", "hello", "world");
|
LL - writeln!(v, "{1} {0}", "hello", "world");
|
||||||
LL + writeln!(v, "world {0}", "hello");
|
LL + writeln!(v, "world {0}", "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:41:32
|
--> $DIR/write_literal.rs:41:32
|
||||||
|
@ -93,7 +93,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{foo} {bar}", foo = "hello", bar = "world");
|
LL - writeln!(v, "{foo} {bar}", foo = "hello", bar = "world");
|
||||||
LL + writeln!(v, "hello {bar}", bar = "world");
|
LL + writeln!(v, "hello {bar}", bar = "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:41:47
|
--> $DIR/write_literal.rs:41:47
|
||||||
|
@ -105,7 +105,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{foo} {bar}", foo = "hello", bar = "world");
|
LL - writeln!(v, "{foo} {bar}", foo = "hello", bar = "world");
|
||||||
LL + writeln!(v, "{foo} world", foo = "hello");
|
LL + writeln!(v, "{foo} world", foo = "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:42:32
|
--> $DIR/write_literal.rs:42:32
|
||||||
|
@ -117,7 +117,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{bar} {foo}", foo = "hello", bar = "world");
|
LL - writeln!(v, "{bar} {foo}", foo = "hello", bar = "world");
|
||||||
LL + writeln!(v, "{bar} hello", bar = "world");
|
LL + writeln!(v, "{bar} hello", bar = "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal.rs:42:47
|
--> $DIR/write_literal.rs:42:47
|
||||||
|
@ -129,7 +129,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{bar} {foo}", foo = "hello", bar = "world");
|
LL - writeln!(v, "{bar} {foo}", foo = "hello", bar = "world");
|
||||||
LL + writeln!(v, "world {foo}", foo = "hello");
|
LL + writeln!(v, "world {foo}", foo = "hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 11 previous errors
|
error: aborting due to 11 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{}", "{hello}");
|
LL - writeln!(v, "{}", "{hello}");
|
||||||
LL + writeln!(v, "{{hello}}");
|
LL + writeln!(v, "{{hello}}");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal_2.rs:10:24
|
--> $DIR/write_literal_2.rs:10:24
|
||||||
|
@ -21,7 +21,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, r"{}", r"{hello}");
|
LL - writeln!(v, r"{}", r"{hello}");
|
||||||
LL + writeln!(v, r"{{hello}}");
|
LL + writeln!(v, r"{{hello}}");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal_2.rs:11:23
|
--> $DIR/write_literal_2.rs:11:23
|
||||||
|
@ -33,7 +33,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{}", '/'');
|
LL - writeln!(v, "{}", '/'');
|
||||||
LL + writeln!(v, "'");
|
LL + writeln!(v, "'");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal_2.rs:12:23
|
--> $DIR/write_literal_2.rs:12:23
|
||||||
|
@ -45,7 +45,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, "{}", '"');
|
LL - writeln!(v, "{}", '"');
|
||||||
LL + writeln!(v, "/"");
|
LL + writeln!(v, "/"");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal_2.rs:14:24
|
--> $DIR/write_literal_2.rs:14:24
|
||||||
|
@ -57,7 +57,7 @@ help: try this
|
||||||
|
|
|
|
||||||
LL - writeln!(v, r"{}", '/'');
|
LL - writeln!(v, r"{}", '/'');
|
||||||
LL + writeln!(v, r"'");
|
LL + writeln!(v, r"'");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: literal with an empty format string
|
error: literal with an empty format string
|
||||||
--> $DIR/write_literal_2.rs:18:9
|
--> $DIR/write_literal_2.rs:18:9
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "Hello/n");
|
LL - write!(v, "Hello/n");
|
||||||
LL + writeln!(v, "Hello");
|
LL + writeln!(v, "Hello");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `write!()` with a format string that ends in a single newline
|
error: using `write!()` with a format string that ends in a single newline
|
||||||
--> $DIR/write_with_newline.rs:14:5
|
--> $DIR/write_with_newline.rs:14:5
|
||||||
|
@ -21,7 +21,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "Hello {}/n", "world");
|
LL - write!(v, "Hello {}/n", "world");
|
||||||
LL + writeln!(v, "Hello {}", "world");
|
LL + writeln!(v, "Hello {}", "world");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `write!()` with a format string that ends in a single newline
|
error: using `write!()` with a format string that ends in a single newline
|
||||||
--> $DIR/write_with_newline.rs:15:5
|
--> $DIR/write_with_newline.rs:15:5
|
||||||
|
@ -33,7 +33,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "Hello {} {}/n", "world", "#2");
|
LL - write!(v, "Hello {} {}/n", "world", "#2");
|
||||||
LL + writeln!(v, "Hello {} {}", "world", "#2");
|
LL + writeln!(v, "Hello {} {}", "world", "#2");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `write!()` with a format string that ends in a single newline
|
error: using `write!()` with a format string that ends in a single newline
|
||||||
--> $DIR/write_with_newline.rs:16:5
|
--> $DIR/write_with_newline.rs:16:5
|
||||||
|
@ -45,7 +45,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "{}/n", 1265);
|
LL - write!(v, "{}/n", 1265);
|
||||||
LL + writeln!(v, "{}", 1265);
|
LL + writeln!(v, "{}", 1265);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `write!()` with a format string that ends in a single newline
|
error: using `write!()` with a format string that ends in a single newline
|
||||||
--> $DIR/write_with_newline.rs:17:5
|
--> $DIR/write_with_newline.rs:17:5
|
||||||
|
@ -57,7 +57,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "/n");
|
LL - write!(v, "/n");
|
||||||
LL + writeln!(v);
|
LL + writeln!(v);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `write!()` with a format string that ends in a single newline
|
error: using `write!()` with a format string that ends in a single newline
|
||||||
--> $DIR/write_with_newline.rs:36:5
|
--> $DIR/write_with_newline.rs:36:5
|
||||||
|
@ -69,7 +69,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "//n"); // should fail
|
LL - write!(v, "//n"); // should fail
|
||||||
LL + writeln!(v, "/"); // should fail
|
LL + writeln!(v, "/"); // should fail
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `write!()` with a format string that ends in a single newline
|
error: using `write!()` with a format string that ends in a single newline
|
||||||
--> $DIR/write_with_newline.rs:43:5
|
--> $DIR/write_with_newline.rs:43:5
|
||||||
|
@ -115,7 +115,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "/r/n"); //~ ERROR
|
LL - write!(v, "/r/n"); //~ ERROR
|
||||||
LL + writeln!(v, "/r"); //~ ERROR
|
LL + writeln!(v, "/r"); //~ ERROR
|
||||||
|
|
|
|
||||||
|
|
||||||
error: using `write!()` with a format string that ends in a single newline
|
error: using `write!()` with a format string that ends in a single newline
|
||||||
--> $DIR/write_with_newline.rs:58:5
|
--> $DIR/write_with_newline.rs:58:5
|
||||||
|
@ -127,7 +127,7 @@ help: use `writeln!()` instead
|
||||||
|
|
|
|
||||||
LL - write!(v, "foo/rbar/n");
|
LL - write!(v, "foo/rbar/n");
|
||||||
LL + writeln!(v, "foo/rbar");
|
LL + writeln!(v, "foo/rbar");
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue