mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Auto merge of #120924 - xFrednet:rfc-2383-stabilization-party, r=Urgau,blyxyas
Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383) Let's give this another try! The [previous stabilization attempt](https://github.com/rust-lang/rust/pull/99063) was stalled by some unresolved questions. These have been discussed in a [lang team](https://github.com/rust-lang/lang-team/issues/191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in https://github.com/rust-lang/rust/issues/115980 I've just updated the [stabilization report](https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation. This hopefully covers everything. Let's hope that the CI will be green like the spring. fixes #115980 fixes #54503 --- r? `@wesleywiser` Tacking Issue: https://github.com/rust-lang/rust/issues/54503 Stabilization Report: https://github.com/rust-lang/rust/issues/54503#issuecomment-1179563964 Documentation Update: https://github.com/rust-lang/reference/pull/1237 <!-- For Clippy: changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized --> --- Roses are red, Violets are blue, Let's expect lints, With reason clues
This commit is contained in:
commit
4bc39f028d
@ -5,6 +5,7 @@
|
||||
#![allow(internal_features)]
|
||||
#![allow(rustc::diagnostic_outside_of_impl)]
|
||||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
#![cfg_attr(bootstrap, feature(lint_reasons))]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(assert_matches)]
|
||||
@ -12,7 +13,6 @@
|
||||
#![feature(decl_macro)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(proc_macro_internals)]
|
||||
#![feature(proc_macro_quote)]
|
||||
#![feature(rustdoc_internals)]
|
||||
|
@ -10,6 +10,7 @@
|
||||
#![allow(internal_features)]
|
||||
#![allow(rustc::default_hash_types)]
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
#![cfg_attr(bootstrap, feature(lint_reasons))]
|
||||
#![cfg_attr(not(parallel_compiler), feature(cell_leak))]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
@ -24,7 +25,6 @@
|
||||
#![feature(extend_one)]
|
||||
#![feature(hash_raw_entry)]
|
||||
#![feature(hasher_prefixfree_extras)]
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(macro_metavar_expr)]
|
||||
#![feature(map_try_insert)]
|
||||
#![feature(min_specialization)]
|
||||
|
@ -135,7 +135,12 @@ impl Emitter for JsonEmitter {
|
||||
let data: Vec<FutureBreakageItem<'_>> = diags
|
||||
.into_iter()
|
||||
.map(|mut diag| {
|
||||
if diag.level == crate::Level::Allow {
|
||||
// Allowed or expected lints don't normally (by definition) emit a lint
|
||||
// but future incompat lints are special and are emitted anyway.
|
||||
//
|
||||
// So to avoid ICEs and confused users we "upgrade" the lint level for
|
||||
// those `FutureBreakageItem` to warn.
|
||||
if matches!(diag.level, crate::Level::Allow | crate::Level::Expect(..)) {
|
||||
diag.level = crate::Level::Warning;
|
||||
}
|
||||
FutureBreakageItem {
|
||||
|
@ -232,6 +232,8 @@ declare_features! (
|
||||
(accepted, label_break_value, "1.65.0", Some(48594)),
|
||||
/// Allows `let...else` statements.
|
||||
(accepted, let_else, "1.65.0", Some(87335)),
|
||||
/// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
|
||||
(accepted, lint_reasons, "CURRENT_RUSTC_VERSION", Some(54503)),
|
||||
/// Allows `break {expr}` with a value inside `loop`s.
|
||||
(accepted, loop_break_value, "1.19.0", Some(37339)),
|
||||
/// Allows use of `?` as the Kleene "at most one" operator in macros.
|
||||
|
@ -369,9 +369,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
|
||||
DuplicatesOk, EncodeCrossCrate::No,
|
||||
),
|
||||
gated!(
|
||||
expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk,
|
||||
EncodeCrossCrate::No, lint_reasons, experimental!(expect)
|
||||
ungated!(
|
||||
expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
|
||||
DuplicatesOk, EncodeCrossCrate::No,
|
||||
),
|
||||
ungated!(
|
||||
forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
|
||||
|
@ -512,8 +512,6 @@ declare_features! (
|
||||
/// Allows using `#[link(kind = "link-arg", name = "...")]`
|
||||
/// to pass custom arguments to the linker.
|
||||
(unstable, link_arg_attribute, "1.76.0", Some(99427)),
|
||||
/// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
|
||||
(unstable, lint_reasons, "1.31.0", Some(54503)),
|
||||
/// Give access to additional metadata about declarative macro meta-variables.
|
||||
(unstable, macro_metavar_expr, "1.61.0", Some(83527)),
|
||||
/// Provides a way to concatenate identifiers using metavariable expressions.
|
||||
|
@ -3,7 +3,6 @@ use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint::builtin::UNFULFILLED_LINT_EXPECTATIONS;
|
||||
use rustc_session::lint::LintExpectationId;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
@ -11,10 +10,6 @@ pub(crate) fn provide(providers: &mut Providers) {
|
||||
}
|
||||
|
||||
fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
|
||||
if !tcx.features().active(sym::lint_reasons) {
|
||||
return;
|
||||
}
|
||||
|
||||
let lint_expectations = tcx.lint_expectations(());
|
||||
let fulfilled_expectations = tcx.dcx().steal_fulfilled_expectation_ids();
|
||||
|
||||
|
@ -37,7 +37,6 @@ use rustc_session::lint::{
|
||||
},
|
||||
Level, Lint, LintExpectationId, LintId,
|
||||
};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
@ -788,15 +787,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
||||
ast::MetaItemKind::NameValue(ref name_value) => {
|
||||
if item.path == sym::reason {
|
||||
if let ast::LitKind::Str(rationale, _) = name_value.kind {
|
||||
if !self.features.lint_reasons {
|
||||
feature_err(
|
||||
&self.sess,
|
||||
sym::lint_reasons,
|
||||
item.span,
|
||||
"lint reasons are experimental",
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
reason = Some(rationale);
|
||||
} else {
|
||||
sess.dcx().emit_err(MalformedAttribute {
|
||||
|
@ -608,13 +608,13 @@ declare_lint! {
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
/// The `unfulfilled_lint_expectations` lint detects lint trigger expectations
|
||||
/// that have not been fulfilled.
|
||||
/// The `unfulfilled_lint_expectations` lint detects when a lint expectation is
|
||||
/// unfulfilled.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(lint_reasons)]
|
||||
/// #![cfg_attr(bootstrap, feature(lint_reasons))]
|
||||
///
|
||||
/// #[expect(unused_variables)]
|
||||
/// let x = 10;
|
||||
@ -625,24 +625,14 @@ declare_lint! {
|
||||
///
|
||||
/// ### Explanation
|
||||
///
|
||||
/// It was expected that the marked code would emit a lint. This expectation
|
||||
/// has not been fulfilled.
|
||||
/// The `#[expect]` attribute can be used to create a lint expectation. The
|
||||
/// expectation is fulfilled, if a `#[warn]` attribute at the same location
|
||||
/// would result in a lint emission. If the expectation is unfulfilled,
|
||||
/// because no lint was emitted, this lint will be emitted on the attribute.
|
||||
///
|
||||
/// The `expect` attribute can be removed if this is intended behavior otherwise
|
||||
/// it should be investigated why the expected lint is no longer issued.
|
||||
///
|
||||
/// In rare cases, the expectation might be emitted at a different location than
|
||||
/// shown in the shown code snippet. In most cases, the `#[expect]` attribute
|
||||
/// works when added to the outer scope. A few lints can only be expected
|
||||
/// on a crate level.
|
||||
///
|
||||
/// Part of RFC 2383. The progress is being tracked in [#54503]
|
||||
///
|
||||
/// [#54503]: https://github.com/rust-lang/rust/issues/54503
|
||||
pub UNFULFILLED_LINT_EXPECTATIONS,
|
||||
Warn,
|
||||
"unfulfilled lint expectation",
|
||||
@feature_gate = rustc_span::sym::lint_reasons;
|
||||
"unfulfilled lint expectation"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
|
@ -1,12 +1,13 @@
|
||||
# Lint Levels
|
||||
|
||||
In `rustc`, lints are divided into five *levels*:
|
||||
In `rustc`, lints are divided into six *levels*:
|
||||
|
||||
1. allow
|
||||
2. warn
|
||||
3. force-warn
|
||||
4. deny
|
||||
5. forbid
|
||||
2. expect
|
||||
3. warn
|
||||
4. force-warn
|
||||
5. deny
|
||||
6. forbid
|
||||
|
||||
Each lint has a default level (explained in the lint listing later in this
|
||||
chapter), and the compiler has a default warning level. First, let's explain
|
||||
@ -33,6 +34,40 @@ But this code violates the `missing_docs` lint.
|
||||
These lints exist mostly to be manually turned on via configuration, as we'll
|
||||
talk about later in this section.
|
||||
|
||||
## expect
|
||||
|
||||
Sometimes, it can be helpful to suppress lints, but at the same time ensure that
|
||||
the code in question still emits them. The 'expect' level does exactly this. If
|
||||
the lint in question is not emitted, the `unfulfilled_lint_expectation` lint
|
||||
triggers on the `expect` attribute, notifying you that the expectation is no
|
||||
longer fulfilled.
|
||||
|
||||
```rust
|
||||
fn main() {
|
||||
#[expect(unused_variables)]
|
||||
let unused = "Everyone ignores me";
|
||||
|
||||
#[expect(unused_variables)] // `unused_variables` lint is not emitted
|
||||
let used = "I'm useful"; // the expectation is therefore unfulfilled
|
||||
println!("The `used` value is equal to: {:?}", used);
|
||||
}
|
||||
```
|
||||
|
||||
This will produce the following warning:
|
||||
|
||||
```txt
|
||||
warning: this lint expectation is unfulfilled
|
||||
--> src/main.rs:7:14
|
||||
|
|
||||
7 | #[expect(unused_variables)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
|
||||
```
|
||||
|
||||
This level can only be defined via the `#[expect]` attribute, there is no equivalent
|
||||
flag. Lints with the special 'force-warn' level will still be emitted as usual.
|
||||
|
||||
## warn
|
||||
|
||||
The 'warn' lint level will produce a warning if you violate the lint. For example,
|
||||
@ -240,6 +275,21 @@ And use multiple attributes together:
|
||||
pub fn foo() {}
|
||||
```
|
||||
|
||||
All lint attributes support an additional `reason` parameter, to give context why
|
||||
a certain attribute was added. This reason will be displayed as part of the lint
|
||||
message, if the lint is emitted at the defined level.
|
||||
|
||||
```rust
|
||||
use std::path::PathBuf;
|
||||
pub fn get_path() -> PathBuf {
|
||||
#[allow(unused_mut, reason = "this is only modified on some platforms")]
|
||||
let mut file_name = PathBuf::from("git");
|
||||
#[cfg(target_os = "windows")]
|
||||
file_name.set_extension("exe");
|
||||
file_name
|
||||
}
|
||||
```
|
||||
|
||||
### Capping lints
|
||||
|
||||
`rustc` supports a flag, `--cap-lints LEVEL` that sets the "lint cap level."
|
||||
|
@ -1943,7 +1943,7 @@ Released 2022-05-19
|
||||
[#8218](https://github.com/rust-lang/rust-clippy/pull/8218)
|
||||
* [`needless_match`]
|
||||
[#8471](https://github.com/rust-lang/rust-clippy/pull/8471)
|
||||
* [`allow_attributes_without_reason`] (Requires `#![feature(lint_reasons)]`)
|
||||
* [`allow_attributes_without_reason`]
|
||||
[#8504](https://github.com/rust-lang/rust-clippy/pull/8504)
|
||||
* [`print_in_format_impl`]
|
||||
[#8253](https://github.com/rust-lang/rust-clippy/pull/8253)
|
||||
|
@ -669,6 +669,8 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
|
||||
|
||||
---
|
||||
**Affected lints:**
|
||||
* [`allow_attributes`](https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes)
|
||||
* [`allow_attributes_without_reason`](https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes_without_reason)
|
||||
* [`almost_complete_range`](https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_range)
|
||||
* [`approx_constant`](https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant)
|
||||
* [`assigning_clones`](https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones)
|
||||
|
@ -265,7 +265,7 @@ define_Conf! {
|
||||
///
|
||||
/// Suppress lints whenever the suggested change would cause breakage for other crates.
|
||||
(avoid_breaking_exported_api: bool = true),
|
||||
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS.
|
||||
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS, ALLOW_ATTRIBUTES, ALLOW_ATTRIBUTES_WITHOUT_REASON.
|
||||
///
|
||||
/// The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml`
|
||||
#[default_text = ""]
|
||||
|
@ -17,6 +17,7 @@ macro_rules! msrv_aliases {
|
||||
|
||||
// names may refer to stabilized feature flags or library items
|
||||
msrv_aliases! {
|
||||
1,81,0 { LINT_REASONS_STABILIZATION }
|
||||
1,77,0 { C_STR_LITERALS }
|
||||
1,76,0 { PTR_FROM_REF }
|
||||
1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE }
|
||||
|
@ -1,74 +0,0 @@
|
||||
use ast::{AttrStyle, Attribute};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::is_from_proc_macro;
|
||||
use rustc_ast as ast;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_session::declare_lint_pass;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
|
||||
/// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
|
||||
///
|
||||
/// The expect attribute is still unstable and requires the `lint_reasons`
|
||||
/// on nightly. It can be enabled by adding `#![feature(lint_reasons)]` to
|
||||
/// the crate root.
|
||||
///
|
||||
/// This lint only warns outer attributes (`#[allow]`), as inner attributes
|
||||
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
|
||||
///
|
||||
/// ### Why restrict this?
|
||||
/// `#[allow]` attributes can linger after their reason for existence is gone.
|
||||
/// `#[expect]` attributes suppress the lint emission, but emit a warning if
|
||||
/// the expectation is unfulfilled. This can be useful to be notified when the
|
||||
/// lint is no longer triggered, which may indicate the attribute can be removed.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```rust,ignore
|
||||
/// #[allow(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
/// Use instead:
|
||||
/// ```rust,ignore
|
||||
/// #![feature(lint_reasons)]
|
||||
/// #[expect(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
#[clippy::version = "1.70.0"]
|
||||
pub ALLOW_ATTRIBUTES,
|
||||
restriction,
|
||||
"`#[allow]` will not trigger if a warning isn't found. `#[expect]` triggers if there are no warnings."
|
||||
}
|
||||
|
||||
declare_lint_pass!(AllowAttribute => [ALLOW_ATTRIBUTES]);
|
||||
|
||||
impl LateLintPass<'_> for AllowAttribute {
|
||||
// Separate each crate's features.
|
||||
fn check_attribute<'cx>(&mut self, cx: &LateContext<'cx>, attr: &'cx Attribute) {
|
||||
if !in_external_macro(cx.sess(), attr.span)
|
||||
&& cx.tcx.features().lint_reasons
|
||||
&& let AttrStyle::Outer = attr.style
|
||||
&& let Some(ident) = attr.ident()
|
||||
&& ident.name == rustc_span::symbol::sym::allow
|
||||
&& !is_from_proc_macro(cx, &attr)
|
||||
{
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
ALLOW_ATTRIBUTES,
|
||||
ident.span,
|
||||
"#[allow] attribute found",
|
||||
"replace it with",
|
||||
"expect".into(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
26
src/tools/clippy/clippy_lints/src/attrs/allow_attributes.rs
Normal file
26
src/tools/clippy/clippy_lints/src/attrs/allow_attributes.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::is_from_proc_macro;
|
||||
use rustc_ast::{AttrStyle, Attribute};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_lint::{LateContext, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use super::ALLOW_ATTRIBUTES;
|
||||
|
||||
// Separate each crate's features.
|
||||
pub fn check<'cx>(cx: &LateContext<'cx>, attr: &'cx Attribute) {
|
||||
if !in_external_macro(cx.sess(), attr.span)
|
||||
&& let AttrStyle::Outer = attr.style
|
||||
&& let Some(ident) = attr.ident()
|
||||
&& !is_from_proc_macro(cx, &attr)
|
||||
{
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
ALLOW_ATTRIBUTES,
|
||||
ident.span,
|
||||
"#[allow] attribute found",
|
||||
"replace it with",
|
||||
"expect".into(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
@ -8,11 +8,6 @@ use rustc_span::sym;
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
||||
pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMetaItem], attr: &'cx Attribute) {
|
||||
// Check for the feature
|
||||
if !cx.tcx.features().lint_reasons {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the reason is present
|
||||
if let Some(item) = items.last().and_then(NestedMetaItem::meta_item)
|
||||
&& let MetaItemKind::NameValue(_) = &item.kind
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! checks for attributes
|
||||
|
||||
mod allow_attributes_without_reason;
|
||||
mod allow_attributes;
|
||||
mod blanket_clippy_restriction_lints;
|
||||
mod deprecated_cfg_attr;
|
||||
mod deprecated_semver;
|
||||
@ -14,11 +15,11 @@ mod unnecessary_clippy_cfg;
|
||||
mod useless_attribute;
|
||||
mod utils;
|
||||
|
||||
use clippy_config::msrvs::Msrv;
|
||||
use clippy_config::msrvs::{self, Msrv};
|
||||
use rustc_ast::{Attribute, MetaItemKind, NestedMetaItem};
|
||||
use rustc_hir::{ImplItem, Item, ItemKind, TraitItem};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, impl_lint_pass};
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::sym;
|
||||
use utils::{is_lint_level, is_relevant_impl, is_relevant_item, is_relevant_trait};
|
||||
|
||||
@ -272,23 +273,17 @@ declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for attributes that allow lints without a reason.
|
||||
///
|
||||
/// (This requires the `lint_reasons` feature)
|
||||
///
|
||||
/// ### Why restrict this?
|
||||
/// Justifying each `allow` helps readers understand the reasoning,
|
||||
/// and may allow removing `allow` attributes if their purpose is obsolete.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// #![feature(lint_reasons)]
|
||||
///
|
||||
/// #![allow(clippy::some_lint)]
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```no_run
|
||||
/// #![feature(lint_reasons)]
|
||||
///
|
||||
/// #![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")]
|
||||
/// ```
|
||||
#[clippy::version = "1.61.0"]
|
||||
@ -297,6 +292,41 @@ declare_clippy_lint! {
|
||||
"ensures that all `allow` and `expect` attributes have a reason"
|
||||
}
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
|
||||
/// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
|
||||
///
|
||||
/// This lint only warns outer attributes (`#[allow]`), as inner attributes
|
||||
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// `#[expect]` attributes suppress the lint emission, but emit a warning, if
|
||||
/// the expectation is unfulfilled. This can be useful to be notified when the
|
||||
/// lint is no longer triggered.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```rust,ignore
|
||||
/// #[allow(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
/// Use instead:
|
||||
/// ```rust,ignore
|
||||
/// #[expect(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
#[clippy::version = "1.70.0"]
|
||||
pub ALLOW_ATTRIBUTES,
|
||||
restriction,
|
||||
"`#[allow]` will not trigger if a warning isn't found. `#[expect]` triggers if there are no warnings."
|
||||
}
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for `#[should_panic]` attributes without specifying the expected panic message.
|
||||
@ -469,7 +499,12 @@ declare_clippy_lint! {
|
||||
"duplicated attribute"
|
||||
}
|
||||
|
||||
declare_lint_pass!(Attributes => [
|
||||
#[derive(Clone)]
|
||||
pub struct Attributes {
|
||||
msrv: Msrv,
|
||||
}
|
||||
|
||||
impl_lint_pass!(Attributes => [
|
||||
ALLOW_ATTRIBUTES_WITHOUT_REASON,
|
||||
INLINE_ALWAYS,
|
||||
DEPRECATED_SEMVER,
|
||||
@ -480,6 +515,13 @@ declare_lint_pass!(Attributes => [
|
||||
DUPLICATED_ATTRIBUTES,
|
||||
]);
|
||||
|
||||
impl Attributes {
|
||||
#[must_use]
|
||||
pub fn new(msrv: Msrv) -> Self {
|
||||
Self { msrv }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for Attributes {
|
||||
fn check_crate(&mut self, cx: &LateContext<'tcx>) {
|
||||
blanket_clippy_restriction_lints::check_command_line(cx);
|
||||
@ -492,9 +534,16 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
|
||||
if is_lint_level(ident.name, attr.id) {
|
||||
blanket_clippy_restriction_lints::check(cx, ident.name, items);
|
||||
}
|
||||
if matches!(ident.name, sym::allow) {
|
||||
if self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) {
|
||||
allow_attributes::check(cx, attr);
|
||||
}
|
||||
}
|
||||
if matches!(ident.name, sym::allow | sym::expect) {
|
||||
if self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) {
|
||||
allow_attributes_without_reason::check(cx, ident.name, items, attr);
|
||||
}
|
||||
}
|
||||
if items.is_empty() || !attr.has_name(sym::deprecated) {
|
||||
return;
|
||||
}
|
||||
@ -537,6 +586,8 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
|
||||
inline_always::check(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()));
|
||||
}
|
||||
}
|
||||
|
||||
extract_msrv_attr!(LateContext);
|
||||
}
|
||||
|
||||
pub struct EarlyAttributes {
|
||||
|
@ -38,7 +38,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::unsorted_clippy_utils_paths::UNSORTED_CLIPPY_UTILS_PATHS_INFO,
|
||||
crate::absolute_paths::ABSOLUTE_PATHS_INFO,
|
||||
crate::allow_attributes::ALLOW_ATTRIBUTES_INFO,
|
||||
crate::almost_complete_range::ALMOST_COMPLETE_RANGE_INFO,
|
||||
crate::approx_const::APPROX_CONSTANT_INFO,
|
||||
crate::arc_with_non_send_sync::ARC_WITH_NON_SEND_SYNC_INFO,
|
||||
@ -49,6 +48,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
|
||||
crate::assertions_on_result_states::ASSERTIONS_ON_RESULT_STATES_INFO,
|
||||
crate::assigning_clones::ASSIGNING_CLONES_INFO,
|
||||
crate::async_yields_async::ASYNC_YIELDS_ASYNC_INFO,
|
||||
crate::attrs::ALLOW_ATTRIBUTES_INFO,
|
||||
crate::attrs::ALLOW_ATTRIBUTES_WITHOUT_REASON_INFO,
|
||||
crate::attrs::BLANKET_CLIPPY_RESTRICTION_LINTS_INFO,
|
||||
crate::attrs::DEPRECATED_CFG_ATTR_INFO,
|
||||
|
@ -6,7 +6,7 @@
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![cfg_attr(bootstrap, feature(lint_reasons))]
|
||||
#![feature(never_type)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(stmt_expr_attributes)]
|
||||
@ -73,7 +73,6 @@ mod renamed_lints;
|
||||
|
||||
// begin lints modules, do not remove this comment, it’s used in `update_lints`
|
||||
mod absolute_paths;
|
||||
mod allow_attributes;
|
||||
mod almost_complete_range;
|
||||
mod approx_const;
|
||||
mod arc_with_non_send_sync;
|
||||
@ -699,7 +698,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
|
||||
store.register_late_pass(|_| Box::new(mut_reference::UnnecessaryMutPassed));
|
||||
store.register_late_pass(|_| Box::<significant_drop_tightening::SignificantDropTightening<'_>>::default());
|
||||
store.register_late_pass(|_| Box::new(len_zero::LenZero));
|
||||
store.register_late_pass(|_| Box::new(attrs::Attributes));
|
||||
store.register_late_pass(move |_| Box::new(attrs::Attributes::new(msrv())));
|
||||
store.register_late_pass(|_| Box::new(blocks_in_conditions::BlocksInConditions));
|
||||
store.register_late_pass(|_| Box::new(unicode::Unicode));
|
||||
store.register_late_pass(|_| Box::new(uninit_vec::UninitVec));
|
||||
@ -1065,7 +1064,6 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
|
||||
store.register_late_pass(|_| Box::new(needless_maybe_sized::NeedlessMaybeSized));
|
||||
store.register_late_pass(|_| Box::new(redundant_async_block::RedundantAsyncBlock));
|
||||
store.register_late_pass(|_| Box::new(let_with_type_underscore::UnderscoreTyped));
|
||||
store.register_late_pass(|_| Box::new(allow_attributes::AllowAttribute));
|
||||
store.register_late_pass(move |_| Box::new(manual_main_separator_str::ManualMainSeparatorStr::new(msrv())));
|
||||
store.register_late_pass(|_| Box::new(unnecessary_struct_initialization::UnnecessaryStruct));
|
||||
store.register_late_pass(move |_| {
|
||||
|
@ -5,7 +5,7 @@
|
||||
#![feature(f16)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![cfg_attr(bootstrap, feature(lint_reasons))]
|
||||
#![feature(never_type)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(assert_matches)]
|
||||
|
@ -2,7 +2,7 @@
|
||||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![cfg_attr(bootstrap, feature(lint_reasons))]
|
||||
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
|
||||
// warn on lints, that are included in `rust-lang/rust`s bootstrap
|
||||
#![warn(rust_2018_idioms, unused_lifetimes)]
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
mod a;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//! Tests macro_metavars_in_unsafe with default configuration
|
||||
#![feature(decl_macro, lint_reasons)]
|
||||
#![feature(decl_macro)]
|
||||
#![warn(clippy::macro_metavars_in_unsafe)]
|
||||
#![allow(clippy::no_effect)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:271:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:270:19
|
||||
|
|
||||
LL | /* Safety: */ unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -9,7 +9,7 @@ LL | /* Safety: */ unsafe {}
|
||||
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:275:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:274:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -17,7 +17,7 @@ LL | unsafe {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:14
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -25,7 +25,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:29
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:29
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -33,7 +33,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:48
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:48
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -41,7 +41,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:18
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:18
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -49,7 +49,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:37
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:37
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -57,7 +57,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:287:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:286:14
|
||||
|
|
||||
LL | let _ = *unsafe { &42 };
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -65,7 +65,7 @@ LL | let _ = *unsafe { &42 };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:292:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:291:19
|
||||
|
|
||||
LL | let _ = match unsafe {} {
|
||||
| ^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ LL | let _ = match unsafe {} {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:298:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:297:14
|
||||
|
|
||||
LL | let _ = &unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -81,7 +81,7 @@ LL | let _ = &unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:302:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:301:14
|
||||
|
|
||||
LL | let _ = [unsafe {}; 5];
|
||||
| ^^^^^^^^^
|
||||
@ -89,7 +89,7 @@ LL | let _ = [unsafe {}; 5];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:306:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:305:13
|
||||
|
|
||||
LL | let _ = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | let _ = unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:316:8
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:315:8
|
||||
|
|
||||
LL | t!(unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -105,7 +105,7 @@ LL | t!(unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:322:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:321:13
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -117,7 +117,7 @@ LL | t!();
|
||||
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:330:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:329:5
|
||||
|
|
||||
LL | unsafe {} // SAFETY:
|
||||
| ^^^^^^^^^
|
||||
@ -125,7 +125,7 @@ LL | unsafe {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:334:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:333:5
|
||||
|
|
||||
LL | unsafe {
|
||||
| ^^^^^^^^
|
||||
@ -133,7 +133,7 @@ LL | unsafe {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:344:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:343:5
|
||||
|
|
||||
LL | unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -141,7 +141,7 @@ LL | unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:348:20
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:20
|
||||
|
|
||||
LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -149,7 +149,7 @@ LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:355:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:5
|
||||
|
|
||||
LL | unsafe impl A for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -157,7 +157,7 @@ LL | unsafe impl A for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:362:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:361:9
|
||||
|
|
||||
LL | unsafe impl B for (u32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -165,7 +165,7 @@ LL | unsafe impl B for (u32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:383:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:382:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -177,7 +177,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -189,7 +189,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:416:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:415:5
|
||||
|
|
||||
LL | unsafe impl T for (i32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -197,7 +197,7 @@ LL | unsafe impl T for (i32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -209,7 +209,7 @@ LL | no_safety_comment!(u32);
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:422:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:421:5
|
||||
|
|
||||
LL | unsafe impl T for (bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -217,7 +217,7 @@ LL | unsafe impl T for (bool) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:468:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:467:5
|
||||
|
|
||||
LL | unsafe impl NoComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -225,7 +225,7 @@ LL | unsafe impl NoComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:472:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:471:19
|
||||
|
|
||||
LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -233,7 +233,7 @@ LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:476:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:475:5
|
||||
|
|
||||
LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -241,13 +241,13 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: constant item has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
|
|
||||
LL | const BIG_NUMBER: i32 = 1000000;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:478:5
|
||||
|
|
||||
LL | // SAFETY:
|
||||
| ^^^^^^^^^^
|
||||
@ -255,7 +255,7 @@ LL | // SAFETY:
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:481:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
|
|
||||
LL | unsafe impl Interference for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -263,7 +263,7 @@ LL | unsafe impl Interference for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:488:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:487:5
|
||||
|
|
||||
LL | unsafe impl ImplInFn for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -271,7 +271,7 @@ LL | unsafe impl ImplInFn for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:497:1
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:1
|
||||
|
|
||||
LL | unsafe impl CrateRoot for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -279,7 +279,7 @@ LL | unsafe impl CrateRoot for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: statement has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
|
|
||||
LL | / let _ = {
|
||||
LL | | if unsafe { true } {
|
||||
@ -291,13 +291,13 @@ LL | | };
|
||||
| |______^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
|
||||
|
|
||||
LL | // SAFETY: this is more than one level away, so it should warn
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:511:12
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:12
|
||||
|
|
||||
LL | if unsafe { true } {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -305,7 +305,7 @@ LL | if unsafe { true } {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:514:23
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:23
|
||||
|
|
||||
LL | let bar = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:271:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:270:19
|
||||
|
|
||||
LL | /* Safety: */ unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -9,7 +9,7 @@ LL | /* Safety: */ unsafe {}
|
||||
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:275:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:274:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -17,7 +17,7 @@ LL | unsafe {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:14
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -25,7 +25,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:29
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:29
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -33,7 +33,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:48
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:48
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -41,7 +41,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:18
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:18
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -49,7 +49,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:37
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:37
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -57,7 +57,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:287:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:286:14
|
||||
|
|
||||
LL | let _ = *unsafe { &42 };
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -65,7 +65,7 @@ LL | let _ = *unsafe { &42 };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:292:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:291:19
|
||||
|
|
||||
LL | let _ = match unsafe {} {
|
||||
| ^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ LL | let _ = match unsafe {} {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:298:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:297:14
|
||||
|
|
||||
LL | let _ = &unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -81,7 +81,7 @@ LL | let _ = &unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:302:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:301:14
|
||||
|
|
||||
LL | let _ = [unsafe {}; 5];
|
||||
| ^^^^^^^^^
|
||||
@ -89,7 +89,7 @@ LL | let _ = [unsafe {}; 5];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:306:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:305:13
|
||||
|
|
||||
LL | let _ = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | let _ = unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:316:8
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:315:8
|
||||
|
|
||||
LL | t!(unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -105,7 +105,7 @@ LL | t!(unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:322:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:321:13
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -117,7 +117,7 @@ LL | t!();
|
||||
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:330:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:329:5
|
||||
|
|
||||
LL | unsafe {} // SAFETY:
|
||||
| ^^^^^^^^^
|
||||
@ -125,7 +125,7 @@ LL | unsafe {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:334:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:333:5
|
||||
|
|
||||
LL | unsafe {
|
||||
| ^^^^^^^^
|
||||
@ -133,7 +133,7 @@ LL | unsafe {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:344:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:343:5
|
||||
|
|
||||
LL | unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -141,7 +141,7 @@ LL | unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:348:20
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:20
|
||||
|
|
||||
LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -149,7 +149,7 @@ LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:355:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:5
|
||||
|
|
||||
LL | unsafe impl A for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -157,7 +157,7 @@ LL | unsafe impl A for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:362:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:361:9
|
||||
|
|
||||
LL | unsafe impl B for (u32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -165,7 +165,7 @@ LL | unsafe impl B for (u32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:383:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:382:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -177,7 +177,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -189,7 +189,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:416:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:415:5
|
||||
|
|
||||
LL | unsafe impl T for (i32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -197,7 +197,7 @@ LL | unsafe impl T for (i32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -209,7 +209,7 @@ LL | no_safety_comment!(u32);
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:422:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:421:5
|
||||
|
|
||||
LL | unsafe impl T for (bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -217,7 +217,7 @@ LL | unsafe impl T for (bool) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:468:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:467:5
|
||||
|
|
||||
LL | unsafe impl NoComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -225,7 +225,7 @@ LL | unsafe impl NoComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:472:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:471:19
|
||||
|
|
||||
LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -233,7 +233,7 @@ LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:476:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:475:5
|
||||
|
|
||||
LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -241,13 +241,13 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: constant item has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
|
|
||||
LL | const BIG_NUMBER: i32 = 1000000;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:478:5
|
||||
|
|
||||
LL | // SAFETY:
|
||||
| ^^^^^^^^^^
|
||||
@ -255,7 +255,7 @@ LL | // SAFETY:
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:481:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
|
|
||||
LL | unsafe impl Interference for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -263,7 +263,7 @@ LL | unsafe impl Interference for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:488:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:487:5
|
||||
|
|
||||
LL | unsafe impl ImplInFn for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -271,7 +271,7 @@ LL | unsafe impl ImplInFn for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:497:1
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:1
|
||||
|
|
||||
LL | unsafe impl CrateRoot for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -279,7 +279,7 @@ LL | unsafe impl CrateRoot for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:507:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:506:9
|
||||
|
|
||||
LL | unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -287,7 +287,7 @@ LL | unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: statement has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
|
|
||||
LL | / let _ = {
|
||||
LL | | if unsafe { true } {
|
||||
@ -299,13 +299,13 @@ LL | | };
|
||||
| |______^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
|
||||
|
|
||||
LL | // SAFETY: this is more than one level away, so it should warn
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:511:12
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:12
|
||||
|
|
||||
LL | if unsafe { true } {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -313,7 +313,7 @@ LL | if unsafe { true } {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:514:23
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:23
|
||||
|
|
||||
LL | let bar = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -321,7 +321,7 @@ LL | let bar = unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:532:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:531:9
|
||||
|
|
||||
LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -329,7 +329,7 @@ LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:536:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:535:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -337,7 +337,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:540:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:539:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -345,7 +345,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:546:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:545:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -353,7 +353,7 @@ LL | unsafe {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:550:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:549:5
|
||||
|
|
||||
LL | unsafe {
|
||||
| ^^^^^^^^
|
||||
@ -361,7 +361,7 @@ LL | unsafe {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:557:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:556:9
|
||||
|
|
||||
LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -369,7 +369,7 @@ LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:562:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:561:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -377,7 +377,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:568:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:567:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -385,7 +385,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:573:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:572:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -10,7 +10,6 @@
|
||||
clippy::let_unit_value,
|
||||
clippy::missing_safety_doc
|
||||
)]
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
extern crate proc_macro_unsafe;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::allow_attributes)]
|
||||
#![feature(lint_reasons)]
|
||||
#![no_main]
|
||||
|
||||
extern crate proc_macros;
|
||||
@ -47,3 +46,15 @@ fn ignore_proc_macro() {
|
||||
fn ignore_inner_attr() {
|
||||
#![allow(unused)] // Should not lint
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.81"]
|
||||
fn msrv_1_81() {
|
||||
#[expect(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.80"]
|
||||
fn msrv_1_80() {
|
||||
#[allow(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::allow_attributes)]
|
||||
#![feature(lint_reasons)]
|
||||
#![no_main]
|
||||
|
||||
extern crate proc_macros;
|
||||
@ -47,3 +46,15 @@ fn ignore_proc_macro() {
|
||||
fn ignore_inner_attr() {
|
||||
#![allow(unused)] // Should not lint
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.81"]
|
||||
fn msrv_1_81() {
|
||||
#[allow(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.80"]
|
||||
fn msrv_1_80() {
|
||||
#[allow(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:13:3
|
||||
--> tests/ui/allow_attributes.rs:12:3
|
||||
|
|
||||
LL | #[allow(dead_code)]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
@ -8,10 +8,24 @@ LL | #[allow(dead_code)]
|
||||
= help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]`
|
||||
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:22:30
|
||||
--> tests/ui/allow_attributes.rs:21:30
|
||||
|
|
||||
LL | #[cfg_attr(panic = "unwind", allow(dead_code))]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:52:7
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:52:7
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
#![feature(lint_reasons)]
|
||||
#![deny(clippy::allow_attributes_without_reason)]
|
||||
#![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
|
||||
|
||||
@ -42,3 +41,15 @@ pub fn trigger_fp_result() -> Result<(), &'static str> {
|
||||
Err("asdf")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.81"]
|
||||
fn msrv_1_81() {
|
||||
#[allow(unused)]
|
||||
let _ = 1;
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.80"]
|
||||
fn msrv_1_80() {
|
||||
#[allow(unused)]
|
||||
let _ = 1;
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:4:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:3:1
|
||||
|
|
||||
LL | #![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/allow_attributes_without_reason.rs:3:9
|
||||
--> tests/ui/allow_attributes_without_reason.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::allow_attributes_without_reason)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:10:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:9:1
|
||||
|
|
||||
LL | #[allow(dead_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -20,7 +20,7 @@ LL | #[allow(dead_code)]
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:11:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:10:1
|
||||
|
|
||||
LL | #[allow(dead_code, deprecated)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -28,12 +28,29 @@ LL | #[allow(dead_code, deprecated)]
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: `expect` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:12:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:11:1
|
||||
|
|
||||
LL | #[expect(dead_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:47:5
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:47:5
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(async_closure)]
|
||||
#![warn(clippy::async_yields_async)]
|
||||
#![allow(clippy::redundant_async_block)]
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(async_closure)]
|
||||
#![warn(clippy::async_yields_async)]
|
||||
#![allow(clippy::redundant_async_block)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:39:9
|
||||
--> tests/ui/async_yields_async.rs:38:9
|
||||
|
|
||||
LL | let _h = async {
|
||||
| _____________________-
|
||||
@ -20,7 +20,7 @@ LL + }.await
|
||||
|
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:44:9
|
||||
--> tests/ui/async_yields_async.rs:43:9
|
||||
|
|
||||
LL | let _i = async {
|
||||
| ____________________-
|
||||
@ -33,7 +33,7 @@ LL | | };
|
||||
| |_____- outer async construct
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:50:9
|
||||
--> tests/ui/async_yields_async.rs:49:9
|
||||
|
|
||||
LL | let _j = async || {
|
||||
| ________________________-
|
||||
@ -52,7 +52,7 @@ LL + }.await
|
||||
|
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:55:9
|
||||
--> tests/ui/async_yields_async.rs:54:9
|
||||
|
|
||||
LL | let _k = async || {
|
||||
| _______________________-
|
||||
@ -65,7 +65,7 @@ LL | | };
|
||||
| |_____- outer async construct
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:57:23
|
||||
--> tests/ui/async_yields_async.rs:56:23
|
||||
|
|
||||
LL | let _l = async || CustomFutureType;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
@ -75,7 +75,7 @@ LL | let _l = async || CustomFutureType;
|
||||
| help: consider awaiting this value: `CustomFutureType.await`
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:63:9
|
||||
--> tests/ui/async_yields_async.rs:62:9
|
||||
|
|
||||
LL | let _m = async || {
|
||||
| _______________________-
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(
|
||||
clippy::borrowed_box,
|
||||
clippy::needless_pass_by_value,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:40:13
|
||||
--> tests/ui/boxed_local.rs:39:13
|
||||
|
|
||||
LL | fn warn_arg(x: Box<A>) {
|
||||
| ^
|
||||
@ -8,19 +8,19 @@ LL | fn warn_arg(x: Box<A>) {
|
||||
= help: to override `-D warnings` add `#[allow(clippy::boxed_local)]`
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:123:12
|
||||
--> tests/ui/boxed_local.rs:122:12
|
||||
|
|
||||
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:188:44
|
||||
--> tests/ui/boxed_local.rs:187:44
|
||||
|
|
||||
LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
|
||||
| ^
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:196:16
|
||||
--> tests/ui/boxed_local.rs:195:16
|
||||
|
|
||||
LL | fn foo(x: Box<u32>) {}
|
||||
| ^
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@no-rustfix: overlapping suggestions
|
||||
#![feature(lint_reasons)]
|
||||
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
#![allow(
|
||||
clippy::if_same_then_else,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: called `unwrap` on `x` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:47:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:46:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| -------------- help: try: `if let Some(..) = x`
|
||||
@ -8,13 +8,13 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:35
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:35
|
||||
|
|
||||
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `expect` on `x` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:50:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:49:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| -------------- help: try: `if let Some(..) = x`
|
||||
@ -23,7 +23,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:54:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:53:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| ----------- because of this check
|
||||
@ -32,13 +32,13 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `expect()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:57:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:56:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| ----------- because of this check
|
||||
@ -47,7 +47,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:62:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:61:9
|
||||
|
|
||||
LL | if x.is_none() {
|
||||
| ----------- because of this check
|
||||
@ -56,7 +56,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_none`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:66:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:65:9
|
||||
|
|
||||
LL | if x.is_none() {
|
||||
| -------------- help: try: `if let Some(..) = x`
|
||||
@ -65,7 +65,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:14:13
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:13:13
|
||||
|
|
||||
LL | if $a.is_some() {
|
||||
| --------------- help: try: `if let Some(..) = x`
|
||||
@ -79,7 +79,7 @@ LL | m!(x);
|
||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:79:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:78:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| ------------ help: try: `if let Ok(..) = x`
|
||||
@ -88,7 +88,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `expect` on `x` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:82:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:81:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| ------------ help: try: `if let Ok(..) = x`
|
||||
@ -97,7 +97,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap_err()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:85:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:84:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| --------- because of this check
|
||||
@ -106,7 +106,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:89:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:88:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| --------- because of this check
|
||||
@ -115,7 +115,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: this call to `expect()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:92:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:91:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| --------- because of this check
|
||||
@ -124,7 +124,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:95:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:94:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| ------------ help: try: `if let Err(..) = x`
|
||||
@ -133,7 +133,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:100:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:99:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ---------- because of this check
|
||||
@ -142,7 +142,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `unwrap_err` on `x` after checking its variant with `is_err`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:103:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:102:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ------------- help: try: `if let Err(..) = x`
|
||||
@ -151,7 +151,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_err`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:107:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:106:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ------------- help: try: `if let Ok(..) = x`
|
||||
@ -160,7 +160,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap_err()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:110:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:109:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ---------- because of this check
|
||||
@ -169,7 +169,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `option` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:135:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:134:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ------------------- help: try: `if let Some(..) = &option`
|
||||
@ -177,7 +177,7 @@ LL | option.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:138:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:137:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ---------------- because of this check
|
||||
@ -186,7 +186,7 @@ LL | option.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:145:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:144:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| ----------------- help: try: `if let Ok(..) = &result`
|
||||
@ -194,7 +194,7 @@ LL | result.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:148:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:147:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| -------------- because of this check
|
||||
@ -203,7 +203,7 @@ LL | result.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `option` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:154:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:153:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ------------------- help: try: `if let Some(..) = &mut option`
|
||||
@ -211,7 +211,7 @@ LL | option.as_mut().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:157:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:156:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ---------------- because of this check
|
||||
@ -220,7 +220,7 @@ LL | option.as_mut().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:163:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:162:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| ----------------- help: try: `if let Ok(..) = &mut result`
|
||||
@ -228,7 +228,7 @@ LL | result.as_mut().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:166:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:165:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| -------------- because of this check
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::default_numeric_fallback)]
|
||||
#![allow(
|
||||
unused,
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::default_numeric_fallback)]
|
||||
#![allow(
|
||||
unused,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:17
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:20:17
|
||||
|
|
||||
LL | let x = 22;
|
||||
| ^^ help: consider adding suffix: `22_i32`
|
||||
@ -8,55 +8,61 @@ LL | let x = 22;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::default_numeric_fallback)]`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:18
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:18
|
||||
|
|
||||
LL | let x = [1, 2, 3];
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:21
|
||||
|
|
||||
LL | let x = [1, 2, 3];
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:24
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:24
|
||||
|
|
||||
LL | let x = [1, 2, 3];
|
||||
| ^ help: consider adding suffix: `3_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:28
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:28
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:31
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:31
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:44
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:44
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `3_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:47
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:47
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `4_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:24:23
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:23
|
||||
|
|
||||
LL | let x = match 1 {
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:25:13
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:24:13
|
||||
|
|
||||
LL | 1 => 1,
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:24:18
|
||||
|
|
||||
LL | 1 => 1,
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
@ -64,89 +70,83 @@ LL | 1 => 1,
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:25:18
|
||||
|
|
||||
LL | 1 => 1,
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:26:18
|
||||
|
|
||||
LL | _ => 2,
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:45:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:44:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:53:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:52:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:59:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:58:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:67:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:66:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:83:27
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:82:27
|
||||
|
|
||||
LL | let f = || -> _ { 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:87:29
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:86:29
|
||||
|
|
||||
LL | let f = || -> i32 { 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:101:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:100:21
|
||||
|
|
||||
LL | generic_arg(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:104:32
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:103:32
|
||||
|
|
||||
LL | let x: _ = generic_arg(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:122:28
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:121:28
|
||||
|
|
||||
LL | GenericStruct { x: 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:125:36
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:124:36
|
||||
|
|
||||
LL | let _ = GenericStruct { x: 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:143:24
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:142:24
|
||||
|
|
||||
LL | GenericEnum::X(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:163:23
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:162:23
|
||||
|
|
||||
LL | s.generic_arg(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:173:25
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:172:25
|
||||
|
|
||||
LL | inline!(let x = 22;);
|
||||
| ^^ help: consider adding suffix: `22_i32`
|
||||
@ -154,19 +154,19 @@ LL | inline!(let x = 22;);
|
||||
= note: this error originates in the macro `__inline_mac_fn_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:215:29
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:214:29
|
||||
|
|
||||
LL | let data_i32 = vec![1, 2, 3];
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:215:32
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:214:32
|
||||
|
|
||||
LL | let data_i32 = vec![1, 2, 3];
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:215:35
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:214:35
|
||||
|
|
||||
LL | let data_i32 = vec![1, 2, 3];
|
||||
| ^ help: consider adding suffix: `3_i32`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::derive_partial_eq_without_eq)]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::derive_partial_eq_without_eq)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:12:17
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:11:17
|
||||
|
|
||||
LL | #[derive(Debug, PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
@ -8,73 +8,73 @@ LL | #[derive(Debug, PartialEq)]
|
||||
= help: to override `-D warnings` add `#[allow(clippy::derive_partial_eq_without_eq)]`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:70:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:69:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:76:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:75:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:82:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:81:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:85:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:84:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:91:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:90:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:97:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:96:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:110:17
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:109:17
|
||||
|
|
||||
LL | #[derive(Debug, PartialEq, Clone)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:113:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:112:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:120:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:119:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:123:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:122:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:183:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:182:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:191:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:190:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
//! This file tests the `#[expect]` attribute implementation for tool lints. The same
|
||||
//! file is used to test clippy and rustdoc. Any changes to this file should be synced
|
||||
//! to the other test files as well.
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:31:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:30:14
|
||||
|
|
||||
LL | #[expect(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
@ -8,31 +8,31 @@ LL | #[expect(dead_code)]
|
||||
= help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:37:18
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:36:18
|
||||
|
|
||||
LL | #[expect(invalid_nan_comparisons)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:108:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:107:14
|
||||
|
|
||||
LL | #[expect(clippy::almost_swapped)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:116:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:115:14
|
||||
|
|
||||
LL | #[expect(clippy::bytes_nth)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:122:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:121:14
|
||||
|
|
||||
LL | #[expect(clippy::if_same_then_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:128:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:127:14
|
||||
|
|
||||
LL | #[expect(clippy::overly_complex_bool_expr)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::implicit_return)]
|
||||
#![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::implicit_return)]
|
||||
#![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:11:5
|
||||
--> tests/ui/implicit_return.rs:10:5
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
@ -8,85 +8,85 @@ LL | true
|
||||
= help: to override `-D warnings` add `#[allow(clippy::implicit_return)]`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:15:15
|
||||
--> tests/ui/implicit_return.rs:14:15
|
||||
|
|
||||
LL | if true { true } else { false }
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:15:29
|
||||
--> tests/ui/implicit_return.rs:14:29
|
||||
|
|
||||
LL | if true { true } else { false }
|
||||
| ^^^^^ help: add `return` as shown: `return false`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:21:17
|
||||
--> tests/ui/implicit_return.rs:20:17
|
||||
|
|
||||
LL | true => false,
|
||||
| ^^^^^ help: add `return` as shown: `return false`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:22:20
|
||||
--> tests/ui/implicit_return.rs:21:20
|
||||
|
|
||||
LL | false => { true },
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:35:9
|
||||
--> tests/ui/implicit_return.rs:34:9
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:42:13
|
||||
--> tests/ui/implicit_return.rs:41:13
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:50:13
|
||||
--> tests/ui/implicit_return.rs:49:13
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:68:18
|
||||
--> tests/ui/implicit_return.rs:67:18
|
||||
|
|
||||
LL | let _ = || { true };
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:69:16
|
||||
--> tests/ui/implicit_return.rs:68:16
|
||||
|
|
||||
LL | let _ = || true;
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:77:5
|
||||
--> tests/ui/implicit_return.rs:76:5
|
||||
|
|
||||
LL | format!("test {}", "test")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return format!("test {}", "test")`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:86:5
|
||||
--> tests/ui/implicit_return.rs:85:5
|
||||
|
|
||||
LL | m!(true, false)
|
||||
| ^^^^^^^^^^^^^^^ help: add `return` as shown: `return m!(true, false)`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:92:13
|
||||
--> tests/ui/implicit_return.rs:91:13
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:97:17
|
||||
--> tests/ui/implicit_return.rs:96:17
|
||||
|
|
||||
LL | break 'outer false;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: change `break` to `return` as shown: `return false`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:112:5
|
||||
--> tests/ui/implicit_return.rs:111:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | | m!(true);
|
||||
@ -101,7 +101,7 @@ LL + }
|
||||
|
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:126:5
|
||||
--> tests/ui/implicit_return.rs:125:5
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::let_unit_value)]
|
||||
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::let_unit_value)]
|
||||
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:12:5
|
||||
--> tests/ui/let_unit.rs:11:5
|
||||
|
|
||||
LL | let _x = println!("x");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `println!("x");`
|
||||
@ -8,7 +8,7 @@ LL | let _x = println!("x");
|
||||
= help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]`
|
||||
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:60:5
|
||||
--> tests/ui/let_unit.rs:59:5
|
||||
|
|
||||
LL | / let _ = v
|
||||
LL | | .into_iter()
|
||||
@ -31,7 +31,7 @@ LL + .unwrap();
|
||||
|
|
||||
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:109:5
|
||||
--> tests/ui/let_unit.rs:108:5
|
||||
|
|
||||
LL | / let x = match Some(0) {
|
||||
LL | | None => f2(1),
|
||||
@ -52,7 +52,7 @@ LL + };
|
||||
|
|
||||
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:190:9
|
||||
--> tests/ui/let_unit.rs:189:9
|
||||
|
|
||||
LL | let res = returns_unit();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//@ignore-32bit
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
|
||||
#![allow(clippy::single_component_path_imports)]
|
||||
#![warn(clippy::macro_use_imports)]
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//@ignore-32bit
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
|
||||
#![allow(clippy::single_component_path_imports)]
|
||||
#![warn(clippy::macro_use_imports)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
|
||||
--> tests/ui/macro_use_imports.rs:19:5
|
||||
--> tests/ui/macro_use_imports.rs:18:5
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};`
|
||||
@ -8,19 +8,19 @@ LL | #[macro_use]
|
||||
= help: to override `-D warnings` add `#[allow(clippy::macro_use_imports)]`
|
||||
|
||||
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
|
||||
--> tests/ui/macro_use_imports.rs:23:5
|
||||
--> tests/ui/macro_use_imports.rs:22:5
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::mut_mut, inner::try_err};`
|
||||
|
||||
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
|
||||
--> tests/ui/macro_use_imports.rs:25:5
|
||||
--> tests/ui/macro_use_imports.rs:24:5
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;`
|
||||
|
||||
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
|
||||
--> tests/ui/macro_use_imports.rs:21:5
|
||||
--> tests/ui/macro_use_imports.rs:20:5
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mini_mac::ClippyMiniMacroTest;`
|
||||
|
@ -3,7 +3,6 @@
|
||||
//@aux-build:proc_macro_derive.rs
|
||||
//@ignore-32bit
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
|
||||
#![allow(clippy::single_component_path_imports)]
|
||||
#![warn(clippy::macro_use_imports)]
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::manual_non_exhaustive)]
|
||||
#![allow(unused)]
|
||||
//@no-rustfix
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this seems like a manual implementation of the non-exhaustive pattern
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:5:1
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:4:1
|
||||
|
|
||||
LL | enum E {
|
||||
| ^-----
|
||||
@ -15,7 +15,7 @@ LL | | }
|
||||
| |_^
|
||||
|
|
||||
help: remove this variant
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:10:5
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:9:5
|
||||
|
|
||||
LL | _C,
|
||||
| ^^
|
||||
@ -23,7 +23,7 @@ LL | _C,
|
||||
= help: to override `-D warnings` add `#[allow(clippy::manual_non_exhaustive)]`
|
||||
|
||||
error: this seems like a manual implementation of the non-exhaustive pattern
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:30:1
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:29:1
|
||||
|
|
||||
LL | enum NoUnderscore {
|
||||
| ^----------------
|
||||
@ -38,7 +38,7 @@ LL | | }
|
||||
| |_^
|
||||
|
|
||||
help: remove this variant
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:34:5
|
||||
--> tests/ui/manual_non_exhaustive_enum.rs:33:5
|
||||
|
|
||||
LL | C,
|
||||
| ^
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(
|
||||
unused,
|
||||
non_local_definitions,
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(
|
||||
unused,
|
||||
non_local_definitions,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:16:15
|
||||
--> tests/ui/needless_borrow.rs:15:15
|
||||
|
|
||||
LL | let _ = x(&&a); // warn
|
||||
| ^^^ help: change this to: `&a`
|
||||
@ -8,163 +8,163 @@ LL | let _ = x(&&a); // warn
|
||||
= help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:20:13
|
||||
--> tests/ui/needless_borrow.rs:19:13
|
||||
|
|
||||
LL | mut_ref(&mut &mut b); // warn
|
||||
| ^^^^^^^^^^^ help: change this to: `&mut b`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:32:13
|
||||
--> tests/ui/needless_borrow.rs:31:13
|
||||
|
|
||||
LL | &&a
|
||||
| ^^^ help: change this to: `&a`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:34:15
|
||||
--> tests/ui/needless_borrow.rs:33:15
|
||||
|
|
||||
LL | 46 => &&a,
|
||||
| ^^^ help: change this to: `&a`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:40:27
|
||||
--> tests/ui/needless_borrow.rs:39:27
|
||||
|
|
||||
LL | break &ref_a;
|
||||
| ^^^^^^ help: change this to: `ref_a`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:47:15
|
||||
--> tests/ui/needless_borrow.rs:46:15
|
||||
|
|
||||
LL | let _ = x(&&&a);
|
||||
| ^^^^ help: change this to: `&a`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:48:15
|
||||
--> tests/ui/needless_borrow.rs:47:15
|
||||
|
|
||||
LL | let _ = x(&mut &&a);
|
||||
| ^^^^^^^^ help: change this to: `&a`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:49:15
|
||||
--> tests/ui/needless_borrow.rs:48:15
|
||||
|
|
||||
LL | let _ = x(&&&mut b);
|
||||
| ^^^^^^^^ help: change this to: `&mut b`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:50:15
|
||||
--> tests/ui/needless_borrow.rs:49:15
|
||||
|
|
||||
LL | let _ = x(&&ref_a);
|
||||
| ^^^^^^^ help: change this to: `ref_a`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:53:11
|
||||
--> tests/ui/needless_borrow.rs:52:11
|
||||
|
|
||||
LL | x(&b);
|
||||
| ^^ help: change this to: `b`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:60:13
|
||||
--> tests/ui/needless_borrow.rs:59:13
|
||||
|
|
||||
LL | mut_ref(&mut x);
|
||||
| ^^^^^^ help: change this to: `x`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:61:13
|
||||
--> tests/ui/needless_borrow.rs:60:13
|
||||
|
|
||||
LL | mut_ref(&mut &mut x);
|
||||
| ^^^^^^^^^^^ help: change this to: `x`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:62:23
|
||||
--> tests/ui/needless_borrow.rs:61:23
|
||||
|
|
||||
LL | let y: &mut i32 = &mut x;
|
||||
| ^^^^^^ help: change this to: `x`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:63:23
|
||||
--> tests/ui/needless_borrow.rs:62:23
|
||||
|
|
||||
LL | let y: &mut i32 = &mut &mut x;
|
||||
| ^^^^^^^^^^^ help: change this to: `x`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:72:14
|
||||
--> tests/ui/needless_borrow.rs:71:14
|
||||
|
|
||||
LL | 0 => &mut x,
|
||||
| ^^^^^^ help: change this to: `x`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:78:14
|
||||
--> tests/ui/needless_borrow.rs:77:14
|
||||
|
|
||||
LL | 0 => &mut x,
|
||||
| ^^^^^^ help: change this to: `x`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:90:13
|
||||
--> tests/ui/needless_borrow.rs:89:13
|
||||
|
|
||||
LL | let _ = (&x).0;
|
||||
| ^^^^ help: change this to: `x`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:92:22
|
||||
--> tests/ui/needless_borrow.rs:91:22
|
||||
|
|
||||
LL | let _ = unsafe { (&*x).0 };
|
||||
| ^^^^^ help: change this to: `(*x)`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:102:5
|
||||
--> tests/ui/needless_borrow.rs:101:5
|
||||
|
|
||||
LL | (&&()).foo();
|
||||
| ^^^^^^ help: change this to: `(&())`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:111:5
|
||||
--> tests/ui/needless_borrow.rs:110:5
|
||||
|
|
||||
LL | (&&5).foo();
|
||||
| ^^^^^ help: change this to: `(&5)`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:137:23
|
||||
--> tests/ui/needless_borrow.rs:136:23
|
||||
|
|
||||
LL | let x: (&str,) = (&"",);
|
||||
| ^^^ help: change this to: `""`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:179:13
|
||||
--> tests/ui/needless_borrow.rs:178:13
|
||||
|
|
||||
LL | (&self.f)()
|
||||
| ^^^^^^^^^ help: change this to: `(self.f)`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:188:13
|
||||
--> tests/ui/needless_borrow.rs:187:13
|
||||
|
|
||||
LL | (&mut self.f)()
|
||||
| ^^^^^^^^^^^^^ help: change this to: `(self.f)`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:225:22
|
||||
--> tests/ui/needless_borrow.rs:224:22
|
||||
|
|
||||
LL | let _ = &mut (&mut { x.u }).x;
|
||||
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:232:22
|
||||
--> tests/ui/needless_borrow.rs:231:22
|
||||
|
|
||||
LL | let _ = &mut (&mut { x.u }).x;
|
||||
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:236:22
|
||||
--> tests/ui/needless_borrow.rs:235:22
|
||||
|
|
||||
LL | let _ = &mut (&mut x.u).x;
|
||||
| ^^^^^^^^^^ help: change this to: `x.u`
|
||||
|
||||
error: this expression borrows a value the compiler would automatically borrow
|
||||
--> tests/ui/needless_borrow.rs:237:22
|
||||
--> tests/ui/needless_borrow.rs:236:22
|
||||
|
|
||||
LL | let _ = &mut (&mut { x.u }).x;
|
||||
| ^^^^^^^^^^^^^^ help: change this to: `{ x.u }`
|
||||
|
||||
error: this expression creates a reference which is immediately dereferenced by the compiler
|
||||
--> tests/ui/needless_borrow.rs:258:23
|
||||
--> tests/ui/needless_borrow.rs:257:23
|
||||
|
|
||||
LL | option.unwrap_or((&x.0,));
|
||||
| ^^^^ help: change this to: `x.0`
|
||||
|
@ -5,7 +5,6 @@
|
||||
clippy::ptr_arg
|
||||
)]
|
||||
#![warn(clippy::needless_pass_by_ref_mut)]
|
||||
#![feature(lint_reasons)]
|
||||
//@no-rustfix
|
||||
use std::ptr::NonNull;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:12:11
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:11:11
|
||||
|
|
||||
LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
|
||||
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
|
||||
@ -8,79 +8,79 @@ LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
|
||||
= help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:37:12
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:36:12
|
||||
|
|
||||
LL | fn foo6(s: &mut Vec<u32>) {
|
||||
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:47:12
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:46:12
|
||||
|
|
||||
LL | fn bar(&mut self) {}
|
||||
| ^^^^^^^^^ help: consider changing to: `&self`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:50:29
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:49:29
|
||||
|
|
||||
LL | fn mushroom(&self, vec: &mut Vec<i32>) -> usize {
|
||||
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<i32>`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:127:16
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:126:16
|
||||
|
|
||||
LL | async fn a1(x: &mut i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:131:16
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:130:16
|
||||
|
|
||||
LL | async fn a2(x: &mut i32, y: String) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:135:16
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:134:16
|
||||
|
|
||||
LL | async fn a3(x: &mut i32, y: String, z: String) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:139:16
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:138:16
|
||||
|
|
||||
LL | async fn a4(x: &mut i32, y: i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:143:24
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:142:24
|
||||
|
|
||||
LL | async fn a5(x: i32, y: &mut i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:147:24
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:146:24
|
||||
|
|
||||
LL | async fn a6(x: i32, y: &mut i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:151:32
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:150:32
|
||||
|
|
||||
LL | async fn a7(x: i32, y: i32, z: &mut i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:155:24
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:154:24
|
||||
|
|
||||
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:155:45
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:154:45
|
||||
|
|
||||
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:189:16
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:188:16
|
||||
|
|
||||
LL | fn cfg_warn(s: &mut u32) {}
|
||||
| ^^^^^^^^ help: consider changing to: `&u32`
|
||||
@ -88,7 +88,7 @@ LL | fn cfg_warn(s: &mut u32) {}
|
||||
= note: this is cfg-gated and may require further changes
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:195:20
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:194:20
|
||||
|
|
||||
LL | fn cfg_warn(s: &mut u32) {}
|
||||
| ^^^^^^^^ help: consider changing to: `&u32`
|
||||
@ -96,19 +96,19 @@ LL | fn cfg_warn(s: &mut u32) {}
|
||||
= note: this is cfg-gated and may require further changes
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:209:39
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:208:39
|
||||
|
|
||||
LL | async fn inner_async2(x: &mut i32, y: &mut u32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&u32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:217:26
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:216:26
|
||||
|
|
||||
LL | async fn inner_async3(x: &mut i32, y: &mut u32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:236:34
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:235:34
|
||||
|
|
||||
LL | pub async fn call_in_closure1(n: &mut str) {
|
||||
| ^^^^^^^^ help: consider changing to: `&str`
|
||||
@ -116,7 +116,7 @@ LL | pub async fn call_in_closure1(n: &mut str) {
|
||||
= warning: changing this function will impact semver compatibility
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:255:20
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:254:20
|
||||
|
|
||||
LL | pub fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize {
|
||||
| ^^^^^^^^^^ help: consider changing to: `&usize`
|
||||
@ -124,7 +124,7 @@ LL | pub fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize {
|
||||
= warning: changing this function will impact semver compatibility
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:266:26
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:265:26
|
||||
|
|
||||
LL | pub async fn closure4(n: &mut usize) {
|
||||
| ^^^^^^^^^^ help: consider changing to: `&usize`
|
||||
@ -132,85 +132,85 @@ LL | pub async fn closure4(n: &mut usize) {
|
||||
= warning: changing this function will impact semver compatibility
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:315:12
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:314:12
|
||||
|
|
||||
LL | fn bar(&mut self) {}
|
||||
| ^^^^^^^^^ help: consider changing to: `&self`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:317:18
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:316:18
|
||||
|
|
||||
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
|
||||
| ^^^^^^^^^ help: consider changing to: `&self`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:317:45
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:316:45
|
||||
|
|
||||
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&u32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:325:46
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:324:46
|
||||
|
|
||||
LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&u32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:341:18
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:340:18
|
||||
|
|
||||
LL | fn _empty_tup(x: &mut (())) {}
|
||||
| ^^^^^^^^^ help: consider changing to: `&()`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:342:19
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:341:19
|
||||
|
|
||||
LL | fn _single_tup(x: &mut ((i32,))) {}
|
||||
| ^^^^^^^^^^^^^ help: consider changing to: `&(i32,)`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:343:18
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:342:18
|
||||
|
|
||||
LL | fn _multi_tup(x: &mut ((i32, u32))) {}
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider changing to: `&(i32, u32)`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:344:11
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:343:11
|
||||
|
|
||||
LL | fn _fn(x: &mut (fn())) {}
|
||||
| ^^^^^^^^^^^ help: consider changing to: `&fn()`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:346:23
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:345:23
|
||||
|
|
||||
LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "Rust" fn()`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:347:20
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:346:20
|
||||
|
|
||||
LL | fn _extern_c_fn(x: &mut extern "C" fn()) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "C" fn()`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:348:18
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:347:18
|
||||
|
|
||||
LL | fn _unsafe_fn(x: &mut unsafe fn()) {}
|
||||
| ^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe fn()`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:349:25
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:348:25
|
||||
|
|
||||
LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn()`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:350:20
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:349:20
|
||||
|
|
||||
LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn(i32)`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:351:20
|
||||
--> tests/ui/needless_pass_by_ref_mut.rs:350:20
|
||||
|
|
||||
LL | fn _fn_with_ret(x: &mut unsafe extern "C" fn() -> (i32)) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn() -> (i32)`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(yeet_expr)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(yeet_expr)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:26:5
|
||||
--> tests/ui/needless_return.rs:25:5
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -13,7 +13,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:30:5
|
||||
--> tests/ui/needless_return.rs:29:5
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -25,7 +25,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:35:5
|
||||
--> tests/ui/needless_return.rs:34:5
|
||||
|
|
||||
LL | return true;;;
|
||||
| ^^^^^^^^^^^
|
||||
@ -37,7 +37,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:40:5
|
||||
--> tests/ui/needless_return.rs:39:5
|
||||
|
|
||||
LL | return true;; ; ;
|
||||
| ^^^^^^^^^^^
|
||||
@ -49,7 +49,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:45:9
|
||||
--> tests/ui/needless_return.rs:44:9
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -61,7 +61,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:47:9
|
||||
--> tests/ui/needless_return.rs:46:9
|
||||
|
|
||||
LL | return false;
|
||||
| ^^^^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ LL + false
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:53:17
|
||||
--> tests/ui/needless_return.rs:52:17
|
||||
|
|
||||
LL | true => return false,
|
||||
| ^^^^^^^^^^^^
|
||||
@ -84,7 +84,7 @@ LL | true => false,
|
||||
| ~~~~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:55:13
|
||||
--> tests/ui/needless_return.rs:54:13
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -96,7 +96,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:62:9
|
||||
--> tests/ui/needless_return.rs:61:9
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -108,7 +108,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:64:16
|
||||
--> tests/ui/needless_return.rs:63:16
|
||||
|
|
||||
LL | let _ = || return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -119,7 +119,7 @@ LL | let _ = || true;
|
||||
| ~~~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:68:5
|
||||
--> tests/ui/needless_return.rs:67:5
|
||||
|
|
||||
LL | return the_answer!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -131,7 +131,7 @@ LL + the_answer!()
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:71:21
|
||||
--> tests/ui/needless_return.rs:70:21
|
||||
|
|
||||
LL | fn test_void_fun() {
|
||||
| _____________________^
|
||||
@ -146,7 +146,7 @@ LL + fn test_void_fun() {
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:76:11
|
||||
--> tests/ui/needless_return.rs:75:11
|
||||
|
|
||||
LL | if b {
|
||||
| ___________^
|
||||
@ -161,7 +161,7 @@ LL + if b {
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:78:13
|
||||
--> tests/ui/needless_return.rs:77:13
|
||||
|
|
||||
LL | } else {
|
||||
| _____________^
|
||||
@ -176,7 +176,7 @@ LL + } else {
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:86:14
|
||||
--> tests/ui/needless_return.rs:85:14
|
||||
|
|
||||
LL | _ => return,
|
||||
| ^^^^^^
|
||||
@ -187,7 +187,7 @@ LL | _ => (),
|
||||
| ~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:94:24
|
||||
--> tests/ui/needless_return.rs:93:24
|
||||
|
|
||||
LL | let _ = 42;
|
||||
| ________________________^
|
||||
@ -202,7 +202,7 @@ LL + let _ = 42;
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:97:14
|
||||
--> tests/ui/needless_return.rs:96:14
|
||||
|
|
||||
LL | _ => return,
|
||||
| ^^^^^^
|
||||
@ -213,7 +213,7 @@ LL | _ => (),
|
||||
| ~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:110:9
|
||||
--> tests/ui/needless_return.rs:109:9
|
||||
|
|
||||
LL | return String::from("test");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -225,7 +225,7 @@ LL + String::from("test")
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:112:9
|
||||
--> tests/ui/needless_return.rs:111:9
|
||||
|
|
||||
LL | return String::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -237,7 +237,7 @@ LL + String::new()
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:134:32
|
||||
--> tests/ui/needless_return.rs:133:32
|
||||
|
|
||||
LL | bar.unwrap_or_else(|_| return)
|
||||
| ^^^^^^
|
||||
@ -248,7 +248,7 @@ LL | bar.unwrap_or_else(|_| {})
|
||||
| ~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:138:21
|
||||
--> tests/ui/needless_return.rs:137:21
|
||||
|
|
||||
LL | let _ = || {
|
||||
| _____________________^
|
||||
@ -263,7 +263,7 @@ LL + let _ = || {
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:141:20
|
||||
--> tests/ui/needless_return.rs:140:20
|
||||
|
|
||||
LL | let _ = || return;
|
||||
| ^^^^^^
|
||||
@ -274,7 +274,7 @@ LL | let _ = || {};
|
||||
| ~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:147:32
|
||||
--> tests/ui/needless_return.rs:146:32
|
||||
|
|
||||
LL | res.unwrap_or_else(|_| return Foo)
|
||||
| ^^^^^^^^^^
|
||||
@ -285,7 +285,7 @@ LL | res.unwrap_or_else(|_| Foo)
|
||||
| ~~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:156:5
|
||||
--> tests/ui/needless_return.rs:155:5
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -297,7 +297,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:160:5
|
||||
--> tests/ui/needless_return.rs:159:5
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -309,7 +309,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:165:9
|
||||
--> tests/ui/needless_return.rs:164:9
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -321,7 +321,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:167:9
|
||||
--> tests/ui/needless_return.rs:166:9
|
||||
|
|
||||
LL | return false;
|
||||
| ^^^^^^^^^^^^
|
||||
@ -333,7 +333,7 @@ LL + false
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:173:17
|
||||
--> tests/ui/needless_return.rs:172:17
|
||||
|
|
||||
LL | true => return false,
|
||||
| ^^^^^^^^^^^^
|
||||
@ -344,7 +344,7 @@ LL | true => false,
|
||||
| ~~~~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:175:13
|
||||
--> tests/ui/needless_return.rs:174:13
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -356,7 +356,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:182:9
|
||||
--> tests/ui/needless_return.rs:181:9
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -368,7 +368,7 @@ LL + true
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:184:16
|
||||
--> tests/ui/needless_return.rs:183:16
|
||||
|
|
||||
LL | let _ = || return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -379,7 +379,7 @@ LL | let _ = || true;
|
||||
| ~~~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:188:5
|
||||
--> tests/ui/needless_return.rs:187:5
|
||||
|
|
||||
LL | return the_answer!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -391,7 +391,7 @@ LL + the_answer!()
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:191:33
|
||||
--> tests/ui/needless_return.rs:190:33
|
||||
|
|
||||
LL | async fn async_test_void_fun() {
|
||||
| _________________________________^
|
||||
@ -406,7 +406,7 @@ LL + async fn async_test_void_fun() {
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:196:11
|
||||
--> tests/ui/needless_return.rs:195:11
|
||||
|
|
||||
LL | if b {
|
||||
| ___________^
|
||||
@ -421,7 +421,7 @@ LL + if b {
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:198:13
|
||||
--> tests/ui/needless_return.rs:197:13
|
||||
|
|
||||
LL | } else {
|
||||
| _____________^
|
||||
@ -436,7 +436,7 @@ LL + } else {
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:206:14
|
||||
--> tests/ui/needless_return.rs:205:14
|
||||
|
|
||||
LL | _ => return,
|
||||
| ^^^^^^
|
||||
@ -447,7 +447,7 @@ LL | _ => (),
|
||||
| ~~
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:219:9
|
||||
--> tests/ui/needless_return.rs:218:9
|
||||
|
|
||||
LL | return String::from("test");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -459,7 +459,7 @@ LL + String::from("test")
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:221:9
|
||||
--> tests/ui/needless_return.rs:220:9
|
||||
|
|
||||
LL | return String::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -471,7 +471,7 @@ LL + String::new()
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:237:5
|
||||
--> tests/ui/needless_return.rs:236:5
|
||||
|
|
||||
LL | return format!("Hello {}", "world!");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -483,7 +483,7 @@ LL + format!("Hello {}", "world!")
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:249:9
|
||||
--> tests/ui/needless_return.rs:248:9
|
||||
|
|
||||
LL | return true;
|
||||
| ^^^^^^^^^^^
|
||||
@ -497,7 +497,7 @@ LL ~ }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:251:9
|
||||
--> tests/ui/needless_return.rs:250:9
|
||||
|
|
||||
LL | return false;
|
||||
| ^^^^^^^^^^^^
|
||||
@ -509,7 +509,7 @@ LL ~ }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:258:13
|
||||
--> tests/ui/needless_return.rs:257:13
|
||||
|
|
||||
LL | return 10;
|
||||
| ^^^^^^^^^
|
||||
@ -524,7 +524,7 @@ LL ~ }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:261:13
|
||||
--> tests/ui/needless_return.rs:260:13
|
||||
|
|
||||
LL | return 100;
|
||||
| ^^^^^^^^^^
|
||||
@ -537,7 +537,7 @@ LL ~ }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:269:9
|
||||
--> tests/ui/needless_return.rs:268:9
|
||||
|
|
||||
LL | return 0;
|
||||
| ^^^^^^^^
|
||||
@ -549,7 +549,7 @@ LL ~ }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:276:13
|
||||
--> tests/ui/needless_return.rs:275:13
|
||||
|
|
||||
LL | return *(x as *const isize);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -564,7 +564,7 @@ LL ~ }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:278:13
|
||||
--> tests/ui/needless_return.rs:277:13
|
||||
|
|
||||
LL | return !*(x as *const isize);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -577,7 +577,7 @@ LL ~ }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:285:20
|
||||
--> tests/ui/needless_return.rs:284:20
|
||||
|
|
||||
LL | let _ = 42;
|
||||
| ____________________^
|
||||
@ -594,7 +594,7 @@ LL + let _ = 42;
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:292:20
|
||||
--> tests/ui/needless_return.rs:291:20
|
||||
|
|
||||
LL | let _ = 42; return;
|
||||
| ^^^^^^^
|
||||
@ -606,7 +606,7 @@ LL + let _ = 42;
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:304:9
|
||||
--> tests/ui/needless_return.rs:303:9
|
||||
|
|
||||
LL | return Ok(format!("ok!"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -618,7 +618,7 @@ LL + Ok(format!("ok!"))
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:306:9
|
||||
--> tests/ui/needless_return.rs:305:9
|
||||
|
|
||||
LL | return Err(format!("err!"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -630,7 +630,7 @@ LL + Err(format!("err!"))
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:312:9
|
||||
--> tests/ui/needless_return.rs:311:9
|
||||
|
|
||||
LL | return if true { 1 } else { 2 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -642,7 +642,7 @@ LL + if true { 1 } else { 2 }
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:316:9
|
||||
--> tests/ui/needless_return.rs:315:9
|
||||
|
|
||||
LL | return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -654,7 +654,7 @@ LL + (if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else
|
||||
|
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> tests/ui/needless_return.rs:337:5
|
||||
--> tests/ui/needless_return.rs:336:5
|
||||
|
|
||||
LL | return { "a".to_string() } + "b" + { "c" };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,4 @@
|
||||
//@no-rustfix: overlapping suggestions
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::diverging_sub_expression,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:19:13
|
||||
--> tests/ui/nonminimal_bool.rs:17:13
|
||||
|
|
||||
LL | let _ = !true;
|
||||
| ^^^^^ help: try: `false`
|
||||
@ -8,43 +8,43 @@ LL | let _ = !true;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:22:13
|
||||
--> tests/ui/nonminimal_bool.rs:20:13
|
||||
|
|
||||
LL | let _ = !false;
|
||||
| ^^^^^^ help: try: `true`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:24:13
|
||||
--> tests/ui/nonminimal_bool.rs:22:13
|
||||
|
|
||||
LL | let _ = !!a;
|
||||
| ^^^ help: try: `a`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:26:13
|
||||
--> tests/ui/nonminimal_bool.rs:24:13
|
||||
|
|
||||
LL | let _ = false || a;
|
||||
| ^^^^^^^^^^ help: try: `a`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:31:13
|
||||
--> tests/ui/nonminimal_bool.rs:29:13
|
||||
|
|
||||
LL | let _ = !(!a && b);
|
||||
| ^^^^^^^^^^ help: try: `a || !b`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:33:13
|
||||
--> tests/ui/nonminimal_bool.rs:31:13
|
||||
|
|
||||
LL | let _ = !(!a || b);
|
||||
| ^^^^^^^^^^ help: try: `a && !b`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:35:13
|
||||
--> tests/ui/nonminimal_bool.rs:33:13
|
||||
|
|
||||
LL | let _ = !a && !(b && c);
|
||||
| ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:44:13
|
||||
--> tests/ui/nonminimal_bool.rs:42:13
|
||||
|
|
||||
LL | let _ = a == b && c == 5 && a == b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -57,7 +57,7 @@ LL | let _ = a == b && c == 5;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:46:13
|
||||
--> tests/ui/nonminimal_bool.rs:44:13
|
||||
|
|
||||
LL | let _ = a == b || c == 5 || a == b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -70,7 +70,7 @@ LL | let _ = a == b || c == 5;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:48:13
|
||||
--> tests/ui/nonminimal_bool.rs:46:13
|
||||
|
|
||||
LL | let _ = a == b && c == 5 && b == a;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -83,7 +83,7 @@ LL | let _ = a == b && c == 5;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:50:13
|
||||
--> tests/ui/nonminimal_bool.rs:48:13
|
||||
|
|
||||
LL | let _ = a != b || !(a != b || c == d);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -96,7 +96,7 @@ LL | let _ = a != b || c != d;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:52:13
|
||||
--> tests/ui/nonminimal_bool.rs:50:13
|
||||
|
|
||||
LL | let _ = a != b && !(a != b && c == d);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -109,43 +109,43 @@ LL | let _ = a != b && c != d;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:83:8
|
||||
--> tests/ui/nonminimal_bool.rs:81:8
|
||||
|
|
||||
LL | if matches!(true, true) && true {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:163:8
|
||||
--> tests/ui/nonminimal_bool.rs:161:8
|
||||
|
|
||||
LL | if !(12 == a) {}
|
||||
| ^^^^^^^^^^ help: try: `12 != a`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:164:8
|
||||
--> tests/ui/nonminimal_bool.rs:162:8
|
||||
|
|
||||
LL | if !(a == 12) {}
|
||||
| ^^^^^^^^^^ help: try: `a != 12`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:165:8
|
||||
--> tests/ui/nonminimal_bool.rs:163:8
|
||||
|
|
||||
LL | if !(12 != a) {}
|
||||
| ^^^^^^^^^^ help: try: `12 == a`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:166:8
|
||||
--> tests/ui/nonminimal_bool.rs:164:8
|
||||
|
|
||||
LL | if !(a != 12) {}
|
||||
| ^^^^^^^^^^ help: try: `a == 12`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:170:8
|
||||
--> tests/ui/nonminimal_bool.rs:168:8
|
||||
|
|
||||
LL | if !b == true {}
|
||||
| ^^^^^^^^^^ help: try: `b != true`
|
||||
|
||||
error: this comparison might be written more concisely
|
||||
--> tests/ui/nonminimal_bool.rs:170:8
|
||||
--> tests/ui/nonminimal_bool.rs:168:8
|
||||
|
|
||||
LL | if !b == true {}
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `b != true`
|
||||
@ -154,61 +154,61 @@ LL | if !b == true {}
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]`
|
||||
|
||||
error: equality checks against true are unnecessary
|
||||
--> tests/ui/nonminimal_bool.rs:170:8
|
||||
--> tests/ui/nonminimal_bool.rs:168:8
|
||||
|
|
||||
LL | if !b == true {}
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `!b`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:171:8
|
||||
--> tests/ui/nonminimal_bool.rs:169:8
|
||||
|
|
||||
LL | if !b != true {}
|
||||
| ^^^^^^^^^^ help: try: `b == true`
|
||||
|
||||
error: inequality checks against true can be replaced by a negation
|
||||
--> tests/ui/nonminimal_bool.rs:171:8
|
||||
--> tests/ui/nonminimal_bool.rs:169:8
|
||||
|
|
||||
LL | if !b != true {}
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:172:8
|
||||
--> tests/ui/nonminimal_bool.rs:170:8
|
||||
|
|
||||
LL | if true == !b {}
|
||||
| ^^^^^^^^^^ help: try: `true != b`
|
||||
|
||||
error: this comparison might be written more concisely
|
||||
--> tests/ui/nonminimal_bool.rs:172:8
|
||||
--> tests/ui/nonminimal_bool.rs:170:8
|
||||
|
|
||||
LL | if true == !b {}
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `true != b`
|
||||
|
||||
error: equality checks against true are unnecessary
|
||||
--> tests/ui/nonminimal_bool.rs:172:8
|
||||
--> tests/ui/nonminimal_bool.rs:170:8
|
||||
|
|
||||
LL | if true == !b {}
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `!b`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:173:8
|
||||
--> tests/ui/nonminimal_bool.rs:171:8
|
||||
|
|
||||
LL | if true != !b {}
|
||||
| ^^^^^^^^^^ help: try: `true == b`
|
||||
|
||||
error: inequality checks against true can be replaced by a negation
|
||||
--> tests/ui/nonminimal_bool.rs:173:8
|
||||
--> tests/ui/nonminimal_bool.rs:171:8
|
||||
|
|
||||
LL | if true != !b {}
|
||||
| ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:174:8
|
||||
--> tests/ui/nonminimal_bool.rs:172:8
|
||||
|
|
||||
LL | if !b == !c {}
|
||||
| ^^^^^^^^ help: try: `b == c`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> tests/ui/nonminimal_bool.rs:175:8
|
||||
--> tests/ui/nonminimal_bool.rs:173:8
|
||||
|
|
||||
LL | if !b != !c {}
|
||||
| ^^^^^^^^ help: try: `b != c`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::overly_complex_bool_expr)]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::overly_complex_bool_expr)]
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
error: this boolean expression contains a logic bug
|
||||
--> tests/ui/overly_complex_bool_expr.rs:11:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:10:13
|
||||
|
|
||||
LL | let _ = a && b || a;
|
||||
| ^^^^^^^^^^^ help: it would look like the following: `a`
|
||||
|
|
||||
help: this expression can be optimized out by applying boolean operations to the outer expression
|
||||
--> tests/ui/overly_complex_bool_expr.rs:11:18
|
||||
--> tests/ui/overly_complex_bool_expr.rs:10:18
|
||||
|
|
||||
LL | let _ = a && b || a;
|
||||
| ^
|
||||
@ -13,49 +13,49 @@ LL | let _ = a && b || a;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::overly_complex_bool_expr)]`
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> tests/ui/overly_complex_bool_expr.rs:14:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:13:13
|
||||
|
|
||||
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
|
||||
--> tests/ui/overly_complex_bool_expr.rs:14:22
|
||||
--> tests/ui/overly_complex_bool_expr.rs:13:22
|
||||
|
|
||||
LL | let _ = false && a;
|
||||
| ^
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> tests/ui/overly_complex_bool_expr.rs:25:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:24:13
|
||||
|
|
||||
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
|
||||
--> tests/ui/overly_complex_bool_expr.rs:25:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:24:13
|
||||
|
|
||||
LL | let _ = a == b && a != b;
|
||||
| ^^^^^^
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> tests/ui/overly_complex_bool_expr.rs:27:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:26:13
|
||||
|
|
||||
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
|
||||
--> tests/ui/overly_complex_bool_expr.rs:27:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:26:13
|
||||
|
|
||||
LL | let _ = a < b && a >= b;
|
||||
| ^^^^^
|
||||
|
||||
error: this boolean expression contains a logic bug
|
||||
--> tests/ui/overly_complex_bool_expr.rs:29:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:28:13
|
||||
|
|
||||
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
|
||||
--> tests/ui/overly_complex_bool_expr.rs:29:13
|
||||
--> tests/ui/overly_complex_bool_expr.rs:28:13
|
||||
|
|
||||
LL | let _ = a > b && a <= b;
|
||||
| ^^^^^
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::many_single_char_names,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:14:14
|
||||
--> tests/ui/ptr_arg.rs:13:14
|
||||
|
|
||||
LL | fn do_vec(x: &Vec<i64>) {
|
||||
| ^^^^^^^^^ help: change this to: `&[i64]`
|
||||
@ -8,49 +8,49 @@ LL | fn do_vec(x: &Vec<i64>) {
|
||||
= help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]`
|
||||
|
||||
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:20:18
|
||||
--> tests/ui/ptr_arg.rs:19:18
|
||||
|
|
||||
LL | fn do_vec_mut(x: &mut Vec<i64>) {
|
||||
| ^^^^^^^^^^^^^ help: change this to: `&mut [i64]`
|
||||
|
||||
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:25:19
|
||||
--> tests/ui/ptr_arg.rs:24:19
|
||||
|
|
||||
LL | fn do_vec_mut2(x: &mut Vec<i64>) {
|
||||
| ^^^^^^^^^^^^^ help: change this to: `&mut [i64]`
|
||||
|
||||
error: writing `&String` instead of `&str` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:31:14
|
||||
--> tests/ui/ptr_arg.rs:30:14
|
||||
|
|
||||
LL | fn do_str(x: &String) {
|
||||
| ^^^^^^^ help: change this to: `&str`
|
||||
|
||||
error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:36:18
|
||||
--> tests/ui/ptr_arg.rs:35:18
|
||||
|
|
||||
LL | fn do_str_mut(x: &mut String) {
|
||||
| ^^^^^^^^^^^ help: change this to: `&mut str`
|
||||
|
||||
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:41:15
|
||||
--> tests/ui/ptr_arg.rs:40:15
|
||||
|
|
||||
LL | fn do_path(x: &PathBuf) {
|
||||
| ^^^^^^^^ help: change this to: `&Path`
|
||||
|
||||
error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:46:19
|
||||
--> tests/ui/ptr_arg.rs:45:19
|
||||
|
|
||||
LL | fn do_path_mut(x: &mut PathBuf) {
|
||||
| ^^^^^^^^^^^^ help: change this to: `&mut Path`
|
||||
|
||||
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:55:18
|
||||
--> tests/ui/ptr_arg.rs:54:18
|
||||
|
|
||||
LL | fn do_vec(x: &Vec<i64>);
|
||||
| ^^^^^^^^^ help: change this to: `&[i64]`
|
||||
|
||||
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:69:14
|
||||
--> tests/ui/ptr_arg.rs:68:14
|
||||
|
|
||||
LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
|
||||
| ^^^^^^^^
|
||||
@ -68,7 +68,7 @@ LL ~ x.to_owned()
|
||||
|
|
||||
|
||||
error: writing `&String` instead of `&str` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:79:18
|
||||
--> tests/ui/ptr_arg.rs:78:18
|
||||
|
|
||||
LL | fn str_cloned(x: &String) -> String {
|
||||
| ^^^^^^^
|
||||
@ -85,7 +85,7 @@ LL ~ x.to_owned()
|
||||
|
|
||||
|
||||
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:88:19
|
||||
--> tests/ui/ptr_arg.rs:87:19
|
||||
|
|
||||
LL | fn path_cloned(x: &PathBuf) -> PathBuf {
|
||||
| ^^^^^^^^
|
||||
@ -102,7 +102,7 @@ LL ~ x.to_path_buf()
|
||||
|
|
||||
|
||||
error: writing `&String` instead of `&str` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:97:44
|
||||
--> tests/ui/ptr_arg.rs:96:44
|
||||
|
|
||||
LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
|
||||
| ^^^^^^^
|
||||
@ -117,19 +117,19 @@ LL ~ let c = y;
|
||||
|
|
||||
|
||||
error: using a reference to `Cow` is not recommended
|
||||
--> tests/ui/ptr_arg.rs:112:25
|
||||
--> tests/ui/ptr_arg.rs:111:25
|
||||
|
|
||||
LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
|
||||
| ^^^^^^^^^^^ help: change this to: `&[i32]`
|
||||
|
||||
error: writing `&String` instead of `&str` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:142:66
|
||||
--> tests/ui/ptr_arg.rs:141:66
|
||||
|
|
||||
LL | fn some_allowed(#[allow(clippy::ptr_arg)] _v: &Vec<u32>, _s: &String) {}
|
||||
| ^^^^^^^ help: change this to: `&str`
|
||||
|
||||
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:172:21
|
||||
--> tests/ui/ptr_arg.rs:171:21
|
||||
|
|
||||
LL | fn foo_vec(vec: &Vec<u8>) {
|
||||
| ^^^^^^^^
|
||||
@ -143,7 +143,7 @@ LL ~ let _ = vec.to_owned().clone();
|
||||
|
|
||||
|
||||
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:178:23
|
||||
--> tests/ui/ptr_arg.rs:177:23
|
||||
|
|
||||
LL | fn foo_path(path: &PathBuf) {
|
||||
| ^^^^^^^^
|
||||
@ -157,7 +157,7 @@ LL ~ let _ = path.to_path_buf().clone();
|
||||
|
|
||||
|
||||
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:184:21
|
||||
--> tests/ui/ptr_arg.rs:183:21
|
||||
|
|
||||
LL | fn foo_str(str: &PathBuf) {
|
||||
| ^^^^^^^^
|
||||
@ -171,43 +171,43 @@ LL ~ let _ = str.to_path_buf().clone();
|
||||
|
|
||||
|
||||
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:191:29
|
||||
--> tests/ui/ptr_arg.rs:190:29
|
||||
|
|
||||
LL | fn mut_vec_slice_methods(v: &mut Vec<u32>) {
|
||||
| ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
|
||||
|
||||
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:254:17
|
||||
--> tests/ui/ptr_arg.rs:253:17
|
||||
|
|
||||
LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
|
||||
| ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
|
||||
|
||||
error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:254:35
|
||||
--> tests/ui/ptr_arg.rs:253:35
|
||||
|
|
||||
LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
|
||||
| ^^^^^^^^^^^ help: change this to: `&mut str`
|
||||
|
||||
error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:254:51
|
||||
--> tests/ui/ptr_arg.rs:253:51
|
||||
|
|
||||
LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
|
||||
| ^^^^^^^^^^^^ help: change this to: `&mut Path`
|
||||
|
||||
error: using a reference to `Cow` is not recommended
|
||||
--> tests/ui/ptr_arg.rs:280:39
|
||||
--> tests/ui/ptr_arg.rs:279:39
|
||||
|
|
||||
LL | fn cow_elided_lifetime<'a>(input: &'a Cow<str>) -> &'a str {
|
||||
| ^^^^^^^^^^^^ help: change this to: `&str`
|
||||
|
||||
error: using a reference to `Cow` is not recommended
|
||||
--> tests/ui/ptr_arg.rs:286:36
|
||||
--> tests/ui/ptr_arg.rs:285:36
|
||||
|
|
||||
LL | fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str {
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `&str`
|
||||
|
||||
error: using a reference to `Cow` is not recommended
|
||||
--> tests/ui/ptr_arg.rs:290:40
|
||||
--> tests/ui/ptr_arg.rs:289:40
|
||||
|
|
||||
LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str {
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `&str`
|
||||
|
@ -1,5 +1,4 @@
|
||||
// rustfix-only-machine-applicable
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::redundant_clone)]
|
||||
#![allow(
|
||||
clippy::drop_non_drop,
|
||||
|
@ -1,5 +1,4 @@
|
||||
// rustfix-only-machine-applicable
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::redundant_clone)]
|
||||
#![allow(
|
||||
clippy::drop_non_drop,
|
||||
|
@ -1,11 +1,11 @@
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:15:42
|
||||
--> tests/ui/redundant_clone.rs:14:42
|
||||
|
|
||||
LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:15:14
|
||||
--> tests/ui/redundant_clone.rs:14:14
|
||||
|
|
||||
LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -13,169 +13,169 @@ LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
|
||||
= help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]`
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:18:15
|
||||
--> tests/ui/redundant_clone.rs:17:15
|
||||
|
|
||||
LL | let _s = s.clone();
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:18:14
|
||||
--> tests/ui/redundant_clone.rs:17:14
|
||||
|
|
||||
LL | let _s = s.clone();
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:21:15
|
||||
--> tests/ui/redundant_clone.rs:20:15
|
||||
|
|
||||
LL | let _s = s.to_string();
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:21:14
|
||||
--> tests/ui/redundant_clone.rs:20:14
|
||||
|
|
||||
LL | let _s = s.to_string();
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:24:15
|
||||
--> tests/ui/redundant_clone.rs:23:15
|
||||
|
|
||||
LL | let _s = s.to_owned();
|
||||
| ^^^^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:24:14
|
||||
--> tests/ui/redundant_clone.rs:23:14
|
||||
|
|
||||
LL | let _s = s.to_owned();
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:26:42
|
||||
--> tests/ui/redundant_clone.rs:25:42
|
||||
|
|
||||
LL | let _s = Path::new("/a/b/").join("c").to_owned();
|
||||
| ^^^^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:26:14
|
||||
--> tests/ui/redundant_clone.rs:25:14
|
||||
|
|
||||
LL | let _s = Path::new("/a/b/").join("c").to_owned();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:28:42
|
||||
--> tests/ui/redundant_clone.rs:27:42
|
||||
|
|
||||
LL | let _s = Path::new("/a/b/").join("c").to_path_buf();
|
||||
| ^^^^^^^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:28:14
|
||||
--> tests/ui/redundant_clone.rs:27:14
|
||||
|
|
||||
LL | let _s = Path::new("/a/b/").join("c").to_path_buf();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:30:29
|
||||
--> tests/ui/redundant_clone.rs:29:29
|
||||
|
|
||||
LL | let _s = OsString::new().to_owned();
|
||||
| ^^^^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:30:14
|
||||
--> tests/ui/redundant_clone.rs:29:14
|
||||
|
|
||||
LL | let _s = OsString::new().to_owned();
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:32:29
|
||||
--> tests/ui/redundant_clone.rs:31:29
|
||||
|
|
||||
LL | let _s = OsString::new().to_os_string();
|
||||
| ^^^^^^^^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:32:14
|
||||
--> tests/ui/redundant_clone.rs:31:14
|
||||
|
|
||||
LL | let _s = OsString::new().to_os_string();
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:43:19
|
||||
--> tests/ui/redundant_clone.rs:42:19
|
||||
|
|
||||
LL | let _t = tup.0.clone();
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:43:14
|
||||
--> tests/ui/redundant_clone.rs:42:14
|
||||
|
|
||||
LL | let _t = tup.0.clone();
|
||||
| ^^^^^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:75:25
|
||||
--> tests/ui/redundant_clone.rs:74:25
|
||||
|
|
||||
LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) }
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:75:24
|
||||
--> tests/ui/redundant_clone.rs:74:24
|
||||
|
|
||||
LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) }
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:131:15
|
||||
|
|
||||
LL | let _s = s.clone();
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:131:14
|
||||
|
|
||||
LL | let _s = s.clone();
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:132:15
|
||||
|
|
||||
LL | let _s = s.clone();
|
||||
LL | let _t = t.clone();
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:132:14
|
||||
|
|
||||
LL | let _s = s.clone();
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:133:15
|
||||
|
|
||||
LL | let _t = t.clone();
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:133:14
|
||||
|
|
||||
LL | let _t = t.clone();
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:143:19
|
||||
--> tests/ui/redundant_clone.rs:142:19
|
||||
|
|
||||
LL | let _f = f.clone();
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:143:18
|
||||
--> tests/ui/redundant_clone.rs:142:18
|
||||
|
|
||||
LL | let _f = f.clone();
|
||||
| ^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:155:14
|
||||
--> tests/ui/redundant_clone.rs:154:14
|
||||
|
|
||||
LL | let y = x.clone().join("matthias");
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: cloned value is neither consumed nor mutated
|
||||
--> tests/ui/redundant_clone.rs:155:13
|
||||
--> tests/ui/redundant_clone.rs:154:13
|
||||
|
|
||||
LL | let y = x.clone().join("matthias");
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: redundant clone
|
||||
--> tests/ui/redundant_clone.rs:209:11
|
||||
--> tests/ui/redundant_clone.rs:208:11
|
||||
|
|
||||
LL | foo(&x.clone(), move || {
|
||||
| ^^^^^^^^ help: remove this
|
||||
|
|
||||
note: this value is dropped without further use
|
||||
--> tests/ui/redundant_clone.rs:209:10
|
||||
--> tests/ui/redundant_clone.rs:208:10
|
||||
|
|
||||
LL | foo(&x.clone(), move || {
|
||||
| ^
|
||||
|
@ -1,6 +1,5 @@
|
||||
// FIXME: run-rustfix waiting on multi-span suggestions
|
||||
//@no-rustfix
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::ref_binding_to_reference)]
|
||||
#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this pattern creates a reference to a reference
|
||||
--> tests/ui/ref_binding_to_reference.rs:31:14
|
||||
--> tests/ui/ref_binding_to_reference.rs:30:14
|
||||
|
|
||||
LL | Some(ref x) => x,
|
||||
| ^^^^^
|
||||
@ -12,7 +12,7 @@ LL | Some(x) => &x,
|
||||
| ~ ~~
|
||||
|
||||
error: this pattern creates a reference to a reference
|
||||
--> tests/ui/ref_binding_to_reference.rs:39:14
|
||||
--> tests/ui/ref_binding_to_reference.rs:38:14
|
||||
|
|
||||
LL | Some(ref x) => {
|
||||
| ^^^^^
|
||||
@ -27,7 +27,7 @@ LL ~ &x
|
||||
|
|
||||
|
||||
error: this pattern creates a reference to a reference
|
||||
--> tests/ui/ref_binding_to_reference.rs:50:14
|
||||
--> tests/ui/ref_binding_to_reference.rs:49:14
|
||||
|
|
||||
LL | Some(ref x) => m2!(x),
|
||||
| ^^^^^
|
||||
@ -38,7 +38,7 @@ LL | Some(x) => m2!(&x),
|
||||
| ~ ~~
|
||||
|
||||
error: this pattern creates a reference to a reference
|
||||
--> tests/ui/ref_binding_to_reference.rs:56:15
|
||||
--> tests/ui/ref_binding_to_reference.rs:55:15
|
||||
|
|
||||
LL | let _ = |&ref x: &&String| {
|
||||
| ^^^^^
|
||||
@ -51,7 +51,7 @@ LL ~ let _: &&String = &x;
|
||||
|
|
||||
|
||||
error: this pattern creates a reference to a reference
|
||||
--> tests/ui/ref_binding_to_reference.rs:63:12
|
||||
--> tests/ui/ref_binding_to_reference.rs:62:12
|
||||
|
|
||||
LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
|
||||
| ^^^^^
|
||||
@ -65,7 +65,7 @@ LL ~ x
|
||||
|
|
||||
|
||||
error: this pattern creates a reference to a reference
|
||||
--> tests/ui/ref_binding_to_reference.rs:71:11
|
||||
--> tests/ui/ref_binding_to_reference.rs:70:11
|
||||
|
|
||||
LL | fn f(&ref x: &&String) {
|
||||
| ^^^^^
|
||||
@ -78,7 +78,7 @@ LL ~ let _: &&String = &x;
|
||||
|
|
||||
|
||||
error: this pattern creates a reference to a reference
|
||||
--> tests/ui/ref_binding_to_reference.rs:80:11
|
||||
--> tests/ui/ref_binding_to_reference.rs:79:11
|
||||
|
|
||||
LL | fn f(&ref x: &&String) {
|
||||
| ^^^^^
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::same_name_method)]
|
||||
#![allow(dead_code, non_camel_case_types)]
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
error: method's name is the same as an existing method in a trait
|
||||
--> tests/ui/same_name_method.rs:21:13
|
||||
--> tests/ui/same_name_method.rs:20:13
|
||||
|
|
||||
LL | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: existing `foo` defined here
|
||||
--> tests/ui/same_name_method.rs:26:13
|
||||
--> tests/ui/same_name_method.rs:25:13
|
||||
|
|
||||
LL | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
@ -13,62 +13,62 @@ LL | fn foo() {}
|
||||
= help: to override `-D warnings` add `#[allow(clippy::same_name_method)]`
|
||||
|
||||
error: method's name is the same as an existing method in a trait
|
||||
--> tests/ui/same_name_method.rs:36:13
|
||||
--> tests/ui/same_name_method.rs:35:13
|
||||
|
|
||||
LL | fn clone() {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
note: existing `clone` defined here
|
||||
--> tests/ui/same_name_method.rs:32:18
|
||||
--> tests/ui/same_name_method.rs:31:18
|
||||
|
|
||||
LL | #[derive(Clone)]
|
||||
| ^^^^^
|
||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: method's name is the same as an existing method in a trait
|
||||
--> tests/ui/same_name_method.rs:47:13
|
||||
--> tests/ui/same_name_method.rs:46:13
|
||||
|
|
||||
LL | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: existing `foo` defined here
|
||||
--> tests/ui/same_name_method.rs:52:13
|
||||
--> tests/ui/same_name_method.rs:51:13
|
||||
|
|
||||
LL | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: method's name is the same as an existing method in a trait
|
||||
--> tests/ui/same_name_method.rs:62:13
|
||||
--> tests/ui/same_name_method.rs:61:13
|
||||
|
|
||||
LL | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: existing `foo` defined here
|
||||
--> tests/ui/same_name_method.rs:66:9
|
||||
--> tests/ui/same_name_method.rs:65:9
|
||||
|
|
||||
LL | impl T1 for S {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: method's name is the same as an existing method in a trait
|
||||
--> tests/ui/same_name_method.rs:75:13
|
||||
--> tests/ui/same_name_method.rs:74:13
|
||||
|
|
||||
LL | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: existing `foo` defined here
|
||||
--> tests/ui/same_name_method.rs:80:9
|
||||
--> tests/ui/same_name_method.rs:79:9
|
||||
|
|
||||
LL | impl T1 for S {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: method's name is the same as an existing method in a trait
|
||||
--> tests/ui/same_name_method.rs:75:13
|
||||
--> tests/ui/same_name_method.rs:74:13
|
||||
|
|
||||
LL | fn foo() {}
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: existing `foo` defined here
|
||||
--> tests/ui/same_name_method.rs:82:9
|
||||
--> tests/ui/same_name_method.rs:81:9
|
||||
|
|
||||
LL | impl T2 for S {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::unsafe_derive_deserialize)]
|
||||
#![allow(unused, clippy::missing_safety_doc)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:9:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:8:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
@ -10,7 +10,7 @@ LL | #[derive(Deserialize)]
|
||||
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:18:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:17:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
@ -19,7 +19,7 @@ LL | #[derive(Deserialize)]
|
||||
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:25:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:24:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
@ -28,7 +28,7 @@ LL | #[derive(Deserialize)]
|
||||
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `serde::Deserialize` on a type that has methods using `unsafe`
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:34:10
|
||||
--> tests/ui/unsafe_derive_deserialize.rs:33:10
|
||||
|
|
||||
LL | #[derive(Deserialize)]
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
//@aux-build:proc_macro_derive.rs
|
||||
#![feature(rustc_private, lint_reasons)]
|
||||
#![feature(rustc_private)]
|
||||
#![warn(clippy::used_underscore_binding)]
|
||||
#![allow(clippy::disallowed_names, clippy::eq_op, clippy::uninlined_format_args)]
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#![feature(yeet_expr)]
|
||||
#![feature(nonzero_ops)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![cfg_attr(bootstrap, feature(lint_reasons))]
|
||||
#![feature(trait_upcasting)]
|
||||
#![feature(strict_overflow_ops)]
|
||||
#![feature(is_none_or)]
|
||||
|
@ -142,9 +142,9 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
|
||||
DuplicatesOk, @only_local: true,
|
||||
),
|
||||
gated!(
|
||||
expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk,
|
||||
lint_reasons, experimental!(expect)
|
||||
ungated!(
|
||||
expect, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
|
||||
DuplicatesOk, @only_local: true,
|
||||
),
|
||||
ungated!(
|
||||
forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#),
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@ check-pass
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
//! This file tests the `#[expect]` attribute implementation for tool lints. The same
|
||||
//! file is used to test clippy and rustdoc. Any changes to this file should be synced
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: this lint expectation is unfulfilled
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:16:11
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:15:11
|
||||
|
|
||||
LL | #![expect(rustdoc::missing_crate_level_docs)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -7,19 +7,19 @@ LL | #![expect(rustdoc::missing_crate_level_docs)]
|
||||
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
|
||||
|
||||
warning: this lint expectation is unfulfilled
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:70:14
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:69:14
|
||||
|
|
||||
LL | #[expect(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: this lint expectation is unfulfilled
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:75:14
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:74:14
|
||||
|
|
||||
LL | #[expect(rustdoc::invalid_html_tags)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: this lint expectation is unfulfilled
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:80:14
|
||||
--> $DIR/expect-tool-lint-rfc-2383.rs:79:14
|
||||
|
|
||||
LL | #[expect(rustdoc::bare_urls)]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,8 +1,6 @@
|
||||
//@ check-pass
|
||||
//@ edition: 2021
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::task::Poll;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
pub mod inner {
|
||||
#[expect(unexpected_cfgs)]
|
||||
pub fn i_am_here() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0425]: cannot find function `i_am_not` in module `inner`
|
||||
--> $DIR/diagnostics-not-a-def.rs:14:12
|
||||
--> $DIR/diagnostics-not-a-def.rs:12:12
|
||||
|
|
||||
LL | inner::i_am_not();
|
||||
| ^^^^^^^^ not found in `inner`
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
#![deny(unused_attributes)]
|
||||
#![allow()] //~ ERROR unused attribute
|
||||
#![expect()] //~ ERROR unused attribute
|
||||
|
@ -1,18 +1,18 @@
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:11:1
|
||||
--> $DIR/empty-attributes.rs:9:1
|
||||
|
|
||||
LL | #[repr()]
|
||||
| ^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: attribute `repr` with an empty list has no effect
|
||||
note: the lint level is defined here
|
||||
--> $DIR/empty-attributes.rs:3:9
|
||||
--> $DIR/empty-attributes.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:14:1
|
||||
--> $DIR/empty-attributes.rs:12:1
|
||||
|
|
||||
LL | #[target_feature()]
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
@ -20,7 +20,7 @@ LL | #[target_feature()]
|
||||
= note: attribute `target_feature` with an empty list has no effect
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:4:1
|
||||
--> $DIR/empty-attributes.rs:2:1
|
||||
|
|
||||
LL | #![allow()]
|
||||
| ^^^^^^^^^^^ help: remove this attribute
|
||||
@ -28,7 +28,7 @@ LL | #![allow()]
|
||||
= note: attribute `allow` with an empty list has no effect
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:5:1
|
||||
--> $DIR/empty-attributes.rs:3:1
|
||||
|
|
||||
LL | #![expect()]
|
||||
| ^^^^^^^^^^^^ help: remove this attribute
|
||||
@ -36,7 +36,7 @@ LL | #![expect()]
|
||||
= note: attribute `expect` with an empty list has no effect
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:6:1
|
||||
--> $DIR/empty-attributes.rs:4:1
|
||||
|
|
||||
LL | #![warn()]
|
||||
| ^^^^^^^^^^ help: remove this attribute
|
||||
@ -44,7 +44,7 @@ LL | #![warn()]
|
||||
= note: attribute `warn` with an empty list has no effect
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:7:1
|
||||
--> $DIR/empty-attributes.rs:5:1
|
||||
|
|
||||
LL | #![deny()]
|
||||
| ^^^^^^^^^^ help: remove this attribute
|
||||
@ -52,7 +52,7 @@ LL | #![deny()]
|
||||
= note: attribute `deny` with an empty list has no effect
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:8:1
|
||||
--> $DIR/empty-attributes.rs:6:1
|
||||
|
|
||||
LL | #![forbid()]
|
||||
| ^^^^^^^^^^^^ help: remove this attribute
|
||||
@ -60,7 +60,7 @@ LL | #![forbid()]
|
||||
= note: attribute `forbid` with an empty list has no effect
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/empty-attributes.rs:9:1
|
||||
--> $DIR/empty-attributes.rs:7:1
|
||||
|
|
||||
LL | #![feature()]
|
||||
| ^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
@ -13,6 +13,11 @@ warning[E0602]: unknown lint: `bogus`
|
||||
= note: requested on the command line with `-D bogus`
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
warning: 3 warnings emitted
|
||||
warning[E0602]: unknown lint: `bogus`
|
||||
|
|
||||
= note: requested on the command line with `-D bogus`
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
warning: 4 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0602`.
|
||||
|
@ -1,5 +0,0 @@
|
||||
#![warn(nonstandard_style, reason = "the standard should be respected")]
|
||||
//~^ ERROR lint reasons are experimental
|
||||
//~| ERROR lint reasons are experimental
|
||||
|
||||
fn main() {}
|
@ -1,24 +0,0 @@
|
||||
error[E0658]: lint reasons are experimental
|
||||
--> $DIR/feature-gate-lint-reasons.rs:1:28
|
||||
|
|
||||
LL | #![warn(nonstandard_style, reason = "the standard should be respected")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
|
||||
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: lint reasons are experimental
|
||||
--> $DIR/feature-gate-lint-reasons.rs:1:28
|
||||
|
|
||||
LL | #![warn(nonstandard_style, reason = "the standard should be respected")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
|
||||
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,5 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
pub trait Foo {
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ check-pass
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
pub struct Wrapper<T>(T);
|
||||
|
||||
pub trait Foo {
|
||||
|
@ -5,7 +5,7 @@ LL | let _: &dyn rpitit::Foo = todo!();
|
||||
| ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
|
||||
|
|
||||
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
--> $DIR/auxiliary/rpitit.rs:6:21
|
||||
--> $DIR/auxiliary/rpitit.rs:4:21
|
||||
|
|
||||
LL | fn bar(self) -> impl Deref<Target = impl Sized>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait cannot be made into an object because method `bar` references an `impl Trait` type in its return type
|
||||
|
@ -1,8 +1,6 @@
|
||||
//@ check-pass
|
||||
//@ aux-build: rpitit.rs
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
extern crate rpitit;
|
||||
|
||||
use rpitit::{Foo, Foreign};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user