mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
Auto merge of #9257 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
3c7e7dbc15
24 changed files with 89 additions and 88 deletions
|
@ -1,4 +1,3 @@
|
|||
#![feature(let_chains)]
|
||||
#![feature(let_else)]
|
||||
#![feature(once_cell)]
|
||||
#![feature(rustc_private)]
|
||||
|
|
|
@ -82,7 +82,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessFormat {
|
|||
then {
|
||||
let is_new_string = match value.kind {
|
||||
ExprKind::Binary(..) => true,
|
||||
ExprKind::MethodCall(path, ..) => path.ident.name.as_str() == "to_string",
|
||||
ExprKind::MethodCall(path, ..) => path.ident.name == sym::to_string,
|
||||
_ => false,
|
||||
};
|
||||
let sugg = if is_new_string {
|
||||
|
|
|
@ -141,7 +141,7 @@ fn check_to_string_in_display(cx: &LateContext<'_>, expr: &Expr<'_>) {
|
|||
// Get the hir_id of the object we are calling the method on
|
||||
if let ExprKind::MethodCall(path, [ref self_arg, ..], _) = expr.kind;
|
||||
// Is the method to_string() ?
|
||||
if path.ident.name == sym!(to_string);
|
||||
if path.ident.name == sym::to_string;
|
||||
// Is the method a part of the ToString trait? (i.e. not to_string() implemented
|
||||
// separately)
|
||||
if let Some(expr_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id);
|
||||
|
|
|
@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for InherentToString {
|
|||
if_chain! {
|
||||
// Check if item is a method, called to_string and has a parameter 'self'
|
||||
if let ImplItemKind::Fn(ref signature, _) = impl_item.kind;
|
||||
if impl_item.ident.name.as_str() == "to_string";
|
||||
if impl_item.ident.name == sym::to_string;
|
||||
let decl = &signature.decl;
|
||||
if decl.implicit_self.has_implicit_self();
|
||||
if decl.inputs.len() == 1;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#![feature(control_flow_enum)]
|
||||
#![feature(drain_filter)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(let_else)]
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(never_type)]
|
||||
|
|
|
@ -9,12 +9,14 @@ use rustc_hir::intravisit::{
|
|||
use rustc_hir::FnRetTy::Return;
|
||||
use rustc_hir::{
|
||||
BareFnTy, BodyId, FnDecl, GenericArg, GenericBound, GenericParam, GenericParamKind, Generics, Impl, ImplItem,
|
||||
ImplItemKind, Item, ItemKind, LangItem, Lifetime, LifetimeName, LifetimeParamKind, ParamName, PolyTraitRef,
|
||||
PredicateOrigin, TraitBoundModifier, TraitFn, TraitItem, TraitItemKind, Ty, TyKind, WherePredicate,
|
||||
ImplItemKind, Item, ItemKind, LangItem, Lifetime, LifetimeName, ParamName, PolyTraitRef, PredicateOrigin,
|
||||
TraitBoundModifier, TraitFn, TraitItem, TraitItemKind, Ty, TyKind, WherePredicate,
|
||||
};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::hir::nested_filter as middle_nested_filter;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::source_map::Span;
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
|
||||
|
@ -129,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for Lifetimes {
|
|||
enum RefLt {
|
||||
Unnamed,
|
||||
Static,
|
||||
Named(Symbol),
|
||||
Named(LocalDefId),
|
||||
}
|
||||
|
||||
fn check_fn_inner<'tcx>(
|
||||
|
@ -232,7 +234,7 @@ fn could_use_elision<'tcx>(
|
|||
// level of the current item.
|
||||
|
||||
// check named LTs
|
||||
let allowed_lts = allowed_lts_from(named_generics);
|
||||
let allowed_lts = allowed_lts_from(cx.tcx, named_generics);
|
||||
|
||||
// these will collect all the lifetimes for references in arg/return types
|
||||
let mut input_visitor = RefVisitor::new(cx);
|
||||
|
@ -254,22 +256,6 @@ fn could_use_elision<'tcx>(
|
|||
return false;
|
||||
}
|
||||
|
||||
if allowed_lts
|
||||
.intersection(
|
||||
&input_visitor
|
||||
.nested_elision_site_lts
|
||||
.iter()
|
||||
.chain(output_visitor.nested_elision_site_lts.iter())
|
||||
.cloned()
|
||||
.filter(|v| matches!(v, RefLt::Named(_)))
|
||||
.collect(),
|
||||
)
|
||||
.next()
|
||||
.is_some()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
let input_lts = input_visitor.lts;
|
||||
let output_lts = output_visitor.lts;
|
||||
|
||||
|
@ -303,6 +289,31 @@ fn could_use_elision<'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
// check for higher-ranked trait bounds
|
||||
if !input_visitor.nested_elision_site_lts.is_empty() || !output_visitor.nested_elision_site_lts.is_empty() {
|
||||
let allowed_lts: FxHashSet<_> = allowed_lts
|
||||
.iter()
|
||||
.filter_map(|lt| match lt {
|
||||
RefLt::Named(def_id) => Some(cx.tcx.item_name(def_id.to_def_id())),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
for lt in input_visitor.nested_elision_site_lts {
|
||||
if let RefLt::Named(def_id) = lt {
|
||||
if allowed_lts.contains(&cx.tcx.item_name(def_id.to_def_id())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for lt in output_visitor.nested_elision_site_lts {
|
||||
if let RefLt::Named(def_id) = lt {
|
||||
if allowed_lts.contains(&cx.tcx.item_name(def_id.to_def_id())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no input lifetimes? easy case!
|
||||
if input_lts.is_empty() {
|
||||
false
|
||||
|
@ -335,14 +346,11 @@ fn could_use_elision<'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
fn allowed_lts_from(named_generics: &[GenericParam<'_>]) -> FxHashSet<RefLt> {
|
||||
fn allowed_lts_from(tcx: TyCtxt<'_>, named_generics: &[GenericParam<'_>]) -> FxHashSet<RefLt> {
|
||||
let mut allowed_lts = FxHashSet::default();
|
||||
for par in named_generics.iter() {
|
||||
if let GenericParamKind::Lifetime {
|
||||
kind: LifetimeParamKind::Explicit,
|
||||
} = par.kind
|
||||
{
|
||||
allowed_lts.insert(RefLt::Named(par.name.ident().name));
|
||||
if let GenericParamKind::Lifetime { .. } = par.kind {
|
||||
allowed_lts.insert(RefLt::Named(tcx.hir().local_def_id(par.hir_id)));
|
||||
}
|
||||
}
|
||||
allowed_lts.insert(RefLt::Unnamed);
|
||||
|
@ -385,8 +393,10 @@ impl<'a, 'tcx> RefVisitor<'a, 'tcx> {
|
|||
self.lts.push(RefLt::Unnamed);
|
||||
} else if lt.is_elided() {
|
||||
self.lts.push(RefLt::Unnamed);
|
||||
} else if let LifetimeName::Param(def_id, _) = lt.name {
|
||||
self.lts.push(RefLt::Named(def_id));
|
||||
} else {
|
||||
self.lts.push(RefLt::Named(lt.name.ident().name));
|
||||
self.lts.push(RefLt::Unnamed);
|
||||
}
|
||||
} else {
|
||||
self.lts.push(RefLt::Unnamed);
|
||||
|
@ -434,10 +444,15 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
|
|||
TyKind::OpaqueDef(item, bounds) => {
|
||||
let map = self.cx.tcx.hir();
|
||||
let item = map.item(item);
|
||||
let len = self.lts.len();
|
||||
walk_item(self, item);
|
||||
walk_ty(self, ty);
|
||||
self.lts.truncate(len);
|
||||
self.lts.extend(bounds.iter().filter_map(|bound| match bound {
|
||||
GenericArg::Lifetime(l) => Some(RefLt::Named(l.name.ident().name)),
|
||||
GenericArg::Lifetime(l) => Some(if let LifetimeName::Param(def_id, _) = l.name {
|
||||
RefLt::Named(def_id)
|
||||
} else {
|
||||
RefLt::Unnamed
|
||||
}),
|
||||
_ => None,
|
||||
}));
|
||||
},
|
||||
|
@ -445,7 +460,6 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
|
|||
let mut sub_visitor = RefVisitor::new(self.cx);
|
||||
sub_visitor.visit_fn_decl(decl);
|
||||
self.nested_elision_site_lts.append(&mut sub_visitor.all_lts());
|
||||
return;
|
||||
},
|
||||
TyKind::TraitObject(bounds, ref lt, _) => {
|
||||
if !lt.is_elided() {
|
||||
|
@ -454,11 +468,9 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
|
|||
for bound in bounds {
|
||||
self.visit_poly_trait_ref(bound, TraitBoundModifier::None);
|
||||
}
|
||||
return;
|
||||
},
|
||||
_ => (),
|
||||
_ => walk_ty(self, ty),
|
||||
}
|
||||
walk_ty(self, ty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,7 +489,7 @@ fn has_where_lifetimes<'tcx>(cx: &LateContext<'tcx>, generics: &'tcx Generics<'_
|
|||
return true;
|
||||
}
|
||||
// if the bounds define new lifetimes, they are fine to occur
|
||||
let allowed_lts = allowed_lts_from(pred.bound_generic_params);
|
||||
let allowed_lts = allowed_lts_from(cx.tcx, pred.bound_generic_params);
|
||||
// now walk the bounds
|
||||
for bound in pred.bounds.iter() {
|
||||
walk_param_bound(&mut visitor, bound);
|
||||
|
@ -601,7 +613,7 @@ struct BodyLifetimeChecker {
|
|||
impl<'tcx> Visitor<'tcx> for BodyLifetimeChecker {
|
||||
// for lifetimes as parameters of generics
|
||||
fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) {
|
||||
if lifetime.name.ident().name != kw::Empty && lifetime.name.ident().name != kw::StaticLifetime {
|
||||
if lifetime.name.ident().name != kw::UnderscoreLifetime && lifetime.name.ident().name != kw::StaticLifetime {
|
||||
self.lifetimes_used_in_body = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
|
|||
// - There's only one output lifetime bound using `+ '_`
|
||||
// - All input lifetimes are explicitly bound to the output
|
||||
input_lifetimes.is_empty()
|
||||
|| (output_lifetimes.len() == 1 && matches!(output_lifetimes[0], LifetimeName::Underscore))
|
||||
|| (output_lifetimes.len() == 1 && matches!(output_lifetimes[0], LifetimeName::Infer))
|
||||
|| input_lifetimes
|
||||
.iter()
|
||||
.all(|in_lt| output_lifetimes.iter().any(|out_lt| in_lt == out_lt))
|
||||
|
|
|
@ -14,7 +14,7 @@ use super::INEFFICIENT_TO_STRING;
|
|||
/// Checks for the `INEFFICIENT_TO_STRING` lint
|
||||
pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, method_name: Symbol, args: &[hir::Expr<'_>]) {
|
||||
if_chain! {
|
||||
if args.len() == 1 && method_name == sym!(to_string);
|
||||
if args.len() == 1 && method_name == sym::to_string;
|
||||
if let Some(to_string_meth_did) = cx.typeck_results().type_dependent_def_id(expr.hir_id);
|
||||
if match_def_path(cx, to_string_meth_did, &paths::TO_STRING_METHOD);
|
||||
if let Some(substs) = cx.typeck_results().node_substs_opt(expr.hir_id);
|
||||
|
|
|
@ -427,5 +427,5 @@ fn is_cow_into_owned(cx: &LateContext<'_>, method_name: Symbol, method_def_id: D
|
|||
|
||||
/// Returns true if the named method is `ToString::to_string`.
|
||||
fn is_to_string(cx: &LateContext<'_>, method_name: Symbol, method_def_id: DefId) -> bool {
|
||||
method_name.as_str() == "to_string" && is_diag_trait_item(cx, method_def_id, sym::ToString)
|
||||
method_name == sym::to_string && is_diag_trait_item(cx, method_def_id, sym::ToString)
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ impl fmt::Display for RefPrefix {
|
|||
name.fmt(f)?;
|
||||
f.write_char(' ')?;
|
||||
},
|
||||
LifetimeName::Underscore => f.write_str("'_ ")?,
|
||||
LifetimeName::Infer => f.write_str("'_ ")?,
|
||||
LifetimeName::Static => f.write_str("'static ")?,
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
@ -394,7 +394,7 @@ impl<'tcx> LateLintPass<'tcx> for StrToString {
|
|||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) {
|
||||
if_chain! {
|
||||
if let ExprKind::MethodCall(path, [self_arg, ..], _) = &expr.kind;
|
||||
if path.ident.name == sym!(to_string);
|
||||
if path.ident.name == sym::to_string;
|
||||
let ty = cx.typeck_results().expr_ty(self_arg);
|
||||
if let ty::Ref(_, ty, ..) = ty.kind();
|
||||
if *ty.kind() == ty::Str;
|
||||
|
@ -444,7 +444,7 @@ impl<'tcx> LateLintPass<'tcx> for StringToString {
|
|||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) {
|
||||
if_chain! {
|
||||
if let ExprKind::MethodCall(path, [self_arg, ..], _) = &expr.kind;
|
||||
if path.ident.name == sym!(to_string);
|
||||
if path.ident.name == sym::to_string;
|
||||
let ty = cx.typeck_results().expr_ty(self_arg);
|
||||
if is_type_diagnostic_item(cx, ty, sym::String);
|
||||
then {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#![feature(box_patterns)]
|
||||
#![feature(control_flow_enum)]
|
||||
#![feature(let_else)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(once_cell)]
|
||||
#![feature(rustc_private)]
|
||||
|
@ -2142,7 +2141,7 @@ pub fn is_hir_ty_cfg_dependant(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
|
|||
|
||||
static TEST_ITEM_NAMES_CACHE: OnceLock<Mutex<FxHashMap<LocalDefId, Vec<Symbol>>>> = OnceLock::new();
|
||||
|
||||
fn with_test_item_names<'tcx>(tcx: TyCtxt<'tcx>, module: LocalDefId, f: impl Fn(&[Symbol]) -> bool) -> bool {
|
||||
fn with_test_item_names(tcx: TyCtxt<'_>, module: LocalDefId, f: impl Fn(&[Symbol]) -> bool) -> bool {
|
||||
let cache = TEST_ITEM_NAMES_CACHE.get_or_init(|| Mutex::new(FxHashMap::default()));
|
||||
let mut map: MutexGuard<'_, FxHashMap<LocalDefId, Vec<Symbol>>> = cache.lock().unwrap();
|
||||
let value = map.entry(module);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2022-07-15"
|
||||
channel = "nightly-2022-07-28"
|
||||
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
||||
|
|
|
@ -94,6 +94,8 @@ struct ClippyCallbacks {
|
|||
}
|
||||
|
||||
impl rustc_driver::Callbacks for ClippyCallbacks {
|
||||
// JUSTIFICATION: necessary in clippy driver to set `mir_opt_level`
|
||||
#[cfg_attr(not(bootstrap), allow(rustc::bad_opt_access))]
|
||||
fn config(&mut self, config: &mut interface::Config) {
|
||||
let previous = config.register_lints.take();
|
||||
let clippy_args_var = self.clippy_args_var.take();
|
||||
|
|
|
@ -17,7 +17,7 @@ LL | #![deny(clippy::internal)]
|
|||
| ^^^^^^^^^^^^^^^^
|
||||
= note: `#[deny(clippy::invalid_clippy_version_attribute)]` implied by `#[deny(clippy::internal)]`
|
||||
= help: please use a valid sematic version, see `doc/adding_lints.md`
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this item has an invalid `clippy::version` attribute
|
||||
--> $DIR/check_clippy_version_attribute.rs:48:1
|
||||
|
@ -32,7 +32,7 @@ LL | | }
|
|||
| |_^
|
||||
|
|
||||
= help: please use a valid sematic version, see `doc/adding_lints.md`
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this lint is missing the `clippy::version` attribute or version value
|
||||
--> $DIR/check_clippy_version_attribute.rs:59:1
|
||||
|
@ -48,7 +48,7 @@ LL | | }
|
|||
|
|
||||
= note: `#[deny(clippy::missing_clippy_version_attribute)]` implied by `#[deny(clippy::internal)]`
|
||||
= help: please use a `clippy::version` attribute, see `doc/adding_lints.md`
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this lint is missing the `clippy::version` attribute or version value
|
||||
--> $DIR/check_clippy_version_attribute.rs:67:1
|
||||
|
@ -62,7 +62,7 @@ LL | | }
|
|||
| |_^
|
||||
|
|
||||
= help: please use a `clippy::version` attribute, see `doc/adding_lints.md`
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ note: the lint level is defined here
|
|||
LL | #![deny(clippy::internal)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= note: `#[deny(clippy::default_lint)]` implied by `#[deny(clippy::internal)]`
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ LL | | }
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: this error originates in the macro `__if_chain` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `__if_chain` which comes from the expansion of the macro `if_chain` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: `let` expression should be above the `if_chain!`
|
||||
--> $DIR/if_chain_style.rs:40:9
|
||||
|
|
|
@ -30,15 +30,7 @@ LL | const VAL: T;
|
|||
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
|
||||
|
||||
error: constant expression depends on a generic parameter
|
||||
--> $DIR/ice-6252.rs:13:9
|
||||
|
|
||||
LL | [1; <Multiply<Five, Five>>::VAL];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this may fail depending on what value the parameter takes
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0046, E0412.
|
||||
For more information about an error, try `rustc --explain E0046`.
|
||||
|
|
|
@ -36,7 +36,7 @@ error: sub-expression diverges
|
|||
LL | _ => true || panic!("boo"),
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: sub-expression diverges
|
||||
--> $DIR/diverging_sub_expression.rs:38:26
|
||||
|
|
|
@ -38,7 +38,7 @@ note: potential failure(s)
|
|||
|
|
||||
LL | panic!();
|
||||
| ^^^^^^^^
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: consider implementing `TryFrom` instead
|
||||
--> $DIR/fallible_impl_from.rs:35:1
|
||||
|
@ -65,7 +65,7 @@ LL | } else if s.parse::<u32>().unwrap() != 42 {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | panic!("{:?}", s);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: consider implementing `TryFrom` instead
|
||||
--> $DIR/fallible_impl_from.rs:53:1
|
||||
|
@ -87,7 +87,7 @@ LL | if s.parse::<u32>().ok().unwrap() != 42 {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | panic!("{:?}", s);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | byte_view(panic!());
|
|||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::diverging-sub-expression` implied by `-D warnings`
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: sub-expression diverges
|
||||
--> $DIR/issue-7447.rs:24:19
|
||||
|
@ -13,7 +13,7 @@ error: sub-expression diverges
|
|||
LL | group_entries(panic!());
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-rustfix
|
||||
#![feature(let_chains)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::assign_op_pattern,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// run-rustfix
|
||||
#![feature(let_chains)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::assign_op_pattern,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:23:5
|
||||
--> $DIR/needless_late_init.rs:22:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^ created here
|
||||
|
@ -13,7 +13,7 @@ LL | let a = "zero";
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:26:5
|
||||
--> $DIR/needless_late_init.rs:25:5
|
||||
|
|
||||
LL | let b;
|
||||
| ^^^^^^ created here
|
||||
|
@ -27,7 +27,7 @@ LL | let b = 1;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:27:5
|
||||
--> $DIR/needless_late_init.rs:26:5
|
||||
|
|
||||
LL | let c;
|
||||
| ^^^^^^ created here
|
||||
|
@ -41,7 +41,7 @@ LL | let c = 2;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:31:5
|
||||
--> $DIR/needless_late_init.rs:30:5
|
||||
|
|
||||
LL | let d: usize;
|
||||
| ^^^^^^^^^^^^^ created here
|
||||
|
@ -54,7 +54,7 @@ LL | let d: usize = 1;
|
|||
| ~~~~~~~~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:34:5
|
||||
--> $DIR/needless_late_init.rs:33:5
|
||||
|
|
||||
LL | let e;
|
||||
| ^^^^^^ created here
|
||||
|
@ -67,7 +67,7 @@ LL | let e = format!("{}", d);
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:39:5
|
||||
--> $DIR/needless_late_init.rs:38:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^
|
||||
|
@ -88,7 +88,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:48:5
|
||||
--> $DIR/needless_late_init.rs:47:5
|
||||
|
|
||||
LL | let b;
|
||||
| ^^^^^^
|
||||
|
@ -109,7 +109,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:55:5
|
||||
--> $DIR/needless_late_init.rs:54:5
|
||||
|
|
||||
LL | let d;
|
||||
| ^^^^^^
|
||||
|
@ -130,7 +130,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:63:5
|
||||
--> $DIR/needless_late_init.rs:62:5
|
||||
|
|
||||
LL | let e;
|
||||
| ^^^^^^
|
||||
|
@ -151,7 +151,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:70:5
|
||||
--> $DIR/needless_late_init.rs:69:5
|
||||
|
|
||||
LL | let f;
|
||||
| ^^^^^^
|
||||
|
@ -167,7 +167,7 @@ LL + 1 => "three",
|
|||
|
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:76:5
|
||||
--> $DIR/needless_late_init.rs:75:5
|
||||
|
|
||||
LL | let g: usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
@ -187,7 +187,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:84:5
|
||||
--> $DIR/needless_late_init.rs:83:5
|
||||
|
|
||||
LL | let x;
|
||||
| ^^^^^^ created here
|
||||
|
@ -201,7 +201,7 @@ LL | let x = 1;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:88:5
|
||||
--> $DIR/needless_late_init.rs:87:5
|
||||
|
|
||||
LL | let x;
|
||||
| ^^^^^^ created here
|
||||
|
@ -215,7 +215,7 @@ LL | let x = SignificantDrop;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:92:5
|
||||
--> $DIR/needless_late_init.rs:91:5
|
||||
|
|
||||
LL | let x;
|
||||
| ^^^^^^ created here
|
||||
|
@ -229,7 +229,7 @@ LL | let x = SignificantDrop;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:111:5
|
||||
--> $DIR/needless_late_init.rs:110:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^
|
||||
|
@ -250,7 +250,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:128:5
|
||||
--> $DIR/needless_late_init.rs:127:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^
|
||||
|
|
Loading…
Reference in a new issue