mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Auto merge of #13086 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
b794b8e08c
24 changed files with 70 additions and 64 deletions
|
@ -94,7 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for AssigningClones {
|
|||
},
|
||||
_ => return,
|
||||
}
|
||||
&& let Ok(Some(resolved_fn)) = Instance::resolve(cx.tcx, cx.param_env, fn_id, fn_gen_args)
|
||||
&& let Ok(Some(resolved_fn)) = Instance::try_resolve(cx.tcx, cx.param_env, fn_id, fn_gen_args)
|
||||
// TODO: This check currently bails if the local variable has no initializer.
|
||||
// That is overly conservative - the lint should fire even if there was no initializer,
|
||||
// but the variable has been initialized before `lhs` was evaluated.
|
||||
|
|
|
@ -6,10 +6,11 @@ use clippy_utils::ty::is_type_diagnostic_item;
|
|||
use clippy_utils::visitors::Visitable;
|
||||
use clippy_utils::{in_constant, is_entrypoint_fn, is_trait_impl_item, method_chain_args};
|
||||
use pulldown_cmark::Event::{
|
||||
Code, End, FootnoteReference, HardBreak, Html, Rule, SoftBreak, Start, TaskListMarker, Text,
|
||||
Code, DisplayMath, End, FootnoteReference, HardBreak, Html, InlineHtml, InlineMath, Rule, SoftBreak, Start,
|
||||
TaskListMarker, Text,
|
||||
};
|
||||
use pulldown_cmark::Tag::{BlockQuote, CodeBlock, FootnoteDefinition, Heading, Item, Link, Paragraph};
|
||||
use pulldown_cmark::{BrokenLink, CodeBlockKind, CowStr, Options};
|
||||
use pulldown_cmark::{BrokenLink, CodeBlockKind, CowStr, Options, TagEnd};
|
||||
use rustc_ast::ast::Attribute;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
|
@ -659,7 +660,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
|
|||
|
||||
while let Some((event, range)) = events.next() {
|
||||
match event {
|
||||
Html(tag) => {
|
||||
Html(tag) | InlineHtml(tag) => {
|
||||
if tag.starts_with("<code") {
|
||||
code_level += 1;
|
||||
} else if tag.starts_with("</code") {
|
||||
|
@ -670,11 +671,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
|
|||
blockquote_level -= 1;
|
||||
}
|
||||
},
|
||||
Start(BlockQuote) => {
|
||||
Start(BlockQuote(_)) => {
|
||||
blockquote_level += 1;
|
||||
containers.push(Container::Blockquote);
|
||||
},
|
||||
End(BlockQuote) => {
|
||||
End(TagEnd::BlockQuote) => {
|
||||
blockquote_level -= 1;
|
||||
containers.pop();
|
||||
},
|
||||
|
@ -699,15 +700,15 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
|
|||
}
|
||||
}
|
||||
},
|
||||
End(CodeBlock(_)) => {
|
||||
End(TagEnd::CodeBlock) => {
|
||||
in_code = false;
|
||||
is_rust = false;
|
||||
ignore = false;
|
||||
},
|
||||
Start(Link(_, url, _)) => in_link = Some(url),
|
||||
End(Link(..)) => in_link = None,
|
||||
Start(Heading(_, _, _) | Paragraph | Item) => {
|
||||
if let Start(Heading(_, _, _)) = event {
|
||||
Start(Link { dest_url, .. }) => in_link = Some(dest_url),
|
||||
End(TagEnd::Link) => in_link = None,
|
||||
Start(Heading { .. } | Paragraph | Item) => {
|
||||
if let Start(Heading { .. }) = event {
|
||||
in_heading = true;
|
||||
}
|
||||
if let Start(Item) = event {
|
||||
|
@ -720,11 +721,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
|
|||
ticks_unbalanced = false;
|
||||
paragraph_range = range;
|
||||
},
|
||||
End(Heading(_, _, _) | Paragraph | Item) => {
|
||||
if let End(Heading(_, _, _)) = event {
|
||||
End(TagEnd::Heading(_) | TagEnd::Paragraph | TagEnd::Item) => {
|
||||
if let End(TagEnd::Heading(_)) = event {
|
||||
in_heading = false;
|
||||
}
|
||||
if let End(Item) = event {
|
||||
if let End(TagEnd::Item) = event {
|
||||
containers.pop();
|
||||
}
|
||||
if ticks_unbalanced && let Some(span) = fragments.span(cx, paragraph_range.clone()) {
|
||||
|
@ -746,8 +747,9 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
|
|||
text_to_check = Vec::new();
|
||||
},
|
||||
Start(FootnoteDefinition(..)) => in_footnote_definition = true,
|
||||
End(FootnoteDefinition(..)) => in_footnote_definition = false,
|
||||
Start(_tag) | End(_tag) => (), // We don't care about other tags
|
||||
End(TagEnd::FootnoteDefinition) => in_footnote_definition = false,
|
||||
Start(_) | End(_) // We don't care about other tags
|
||||
| TaskListMarker(_) | Code(_) | Rule | InlineMath(..) | DisplayMath(..) => (),
|
||||
SoftBreak | HardBreak => {
|
||||
if !containers.is_empty()
|
||||
&& let Some((next_event, next_range)) = events.peek()
|
||||
|
@ -766,7 +768,6 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
|
|||
);
|
||||
}
|
||||
},
|
||||
TaskListMarker(_) | Code(_) | Rule => (),
|
||||
FootnoteReference(text) | Text(text) => {
|
||||
paragraph_range.end = range.end;
|
||||
let range_ = range.clone();
|
||||
|
|
|
@ -16,7 +16,7 @@ declare_clippy_lint! {
|
|||
/// and it may be desirable to do so consistently for style.
|
||||
///
|
||||
/// However, removing the brackets also introduces a public constant named after the struct,
|
||||
/// so this is not just a syntactic simplification but an an API change, and adding them back
|
||||
/// so this is not just a syntactic simplification but an API change, and adding them back
|
||||
/// is a *breaking* API change.
|
||||
///
|
||||
/// ### Example
|
||||
|
@ -44,7 +44,7 @@ declare_clippy_lint! {
|
|||
/// and it may be desirable to do so consistently for style.
|
||||
///
|
||||
/// However, removing the brackets also introduces a public constant named after the variant,
|
||||
/// so this is not just a syntactic simplification but an an API change, and adding them back
|
||||
/// so this is not just a syntactic simplification but an API change, and adding them back
|
||||
/// is a *breaking* API change.
|
||||
///
|
||||
/// ### Example
|
||||
|
|
|
@ -15,7 +15,7 @@ use rustc_middle::ty::{
|
|||
use rustc_session::declare_lint_pass;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::traits::error_reporting::InferCtxtExt as _;
|
||||
use rustc_trait_selection::error_reporting::traits::InferCtxtExt as _;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
|
|
|
@ -9,7 +9,7 @@ use rustc_middle::ty::{self, AliasTy, ClauseKind, PredicateKind};
|
|||
use rustc_session::declare_lint_pass;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt;
|
||||
use rustc_trait_selection::error_reporting::traits::suggestions::TypeErrCtxtExt;
|
||||
use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt};
|
||||
|
||||
declare_clippy_lint! {
|
||||
|
|
|
@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
|
|||
&& let [.., path] = poly_trait.trait_ref.path.segments
|
||||
&& poly_trait.bound_generic_params.is_empty()
|
||||
&& let Some(trait_def_id) = path.res.opt_def_id()
|
||||
&& let predicates = cx.tcx.super_predicates_of(trait_def_id).predicates
|
||||
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
|
||||
// If the trait has no supertrait, there is no need to collect anything from that bound
|
||||
&& !predicates.is_empty()
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
|
|||
cx.tcx.is_diagnostic_item(sym::Any, tr.def_id)
|
||||
|| cx
|
||||
.tcx
|
||||
.super_predicates_of(tr.def_id)
|
||||
.explicit_super_predicates_of(tr.def_id)
|
||||
.predicates
|
||||
.iter()
|
||||
.any(|(clause, _)| {
|
||||
|
|
|
@ -91,7 +91,7 @@ fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) ->
|
|||
return true;
|
||||
}
|
||||
|
||||
for &(predicate, _) in cx.tcx.super_predicates_of(trait_def_id).predicates {
|
||||
for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
|
||||
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
|
||||
&& trait_predicate.polarity == PredicatePolarity::Positive
|
||||
&& !path.contains(&trait_predicate.def_id())
|
||||
|
|
|
@ -258,7 +258,7 @@ impl<'tcx> NonCopyConst<'tcx> {
|
|||
// e.g. implementing `has_frozen_variant` described above, and not running this function
|
||||
// when the type doesn't have any frozen variants would be the 'correct' way for the 2nd
|
||||
// case (that actually removes another suboptimal behavior (I won't say 'false positive') where,
|
||||
// similar to 2., but with the a frozen variant) (e.g. borrowing
|
||||
// similar to 2., but with a frozen variant) (e.g. borrowing
|
||||
// `borrow_interior_mutable_const::enums::AssocConsts::TO_BE_FROZEN_VARIANT`).
|
||||
// I chose this way because unfrozen enums as assoc consts are rare (or, hopefully, none).
|
||||
matches!(err, ErrorHandled::TooGeneric(..))
|
||||
|
@ -293,7 +293,7 @@ impl<'tcx> NonCopyConst<'tcx> {
|
|||
ct: ty::UnevaluatedConst<'tcx>,
|
||||
span: Span,
|
||||
) -> EvalToValTreeResult<'tcx> {
|
||||
match ty::Instance::resolve(tcx, param_env, ct.def, ct.args) {
|
||||
match ty::Instance::try_resolve(tcx, param_env, ct.def, ct.args) {
|
||||
Ok(Some(instance)) => {
|
||||
let cid = GlobalId {
|
||||
instance,
|
||||
|
|
|
@ -549,7 +549,7 @@ fn ident_difference_expr_with_base_location(
|
|||
| (Assign(_, _, _), Assign(_, _, _))
|
||||
| (TryBlock(_), TryBlock(_))
|
||||
| (Await(_, _), Await(_, _))
|
||||
| (Gen(_, _, _), Gen(_, _, _))
|
||||
| (Gen(_, _, _, _), Gen(_, _, _, _))
|
||||
| (Block(_, _), Block(_, _))
|
||||
| (Closure(_), Closure(_))
|
||||
| (Match(_, _, _), Match(_, _, _))
|
||||
|
|
|
@ -15,7 +15,7 @@ use rustc_middle::ty::{self, AssocKind, Ty, TyCtxt};
|
|||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_trait_selection::traits::error_reporting::suggestions::ReturnsVisitor;
|
||||
use rustc_trait_selection::error_reporting::traits::suggestions::ReturnsVisitor;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
|
|
|
@ -226,7 +226,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
|
|||
&& eq_fn_decl(lf, rf)
|
||||
&& eq_expr(le, re)
|
||||
},
|
||||
(Gen(lc, lb, lk), Gen(rc, rb, rk)) => lc == rc && eq_block(lb, rb) && lk == rk,
|
||||
(Gen(lc, lb, lk, _), Gen(rc, rb, rk, _)) => lc == rc && eq_block(lb, rb) && lk == rk,
|
||||
(Range(lf, lt, ll), Range(rf, rt, rl)) => ll == rl && eq_expr_opt(lf, rf) && eq_expr_opt(lt, rt),
|
||||
(AddrOf(lbk, lm, le), AddrOf(rbk, rm, re)) => lbk == rbk && lm == rm && eq_expr(le, re),
|
||||
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),
|
||||
|
|
|
@ -330,7 +330,8 @@ fn check_terminator<'tcx>(
|
|||
target: _,
|
||||
unwind: _,
|
||||
fn_span: _,
|
||||
} => {
|
||||
}
|
||||
| TerminatorKind::TailCall { func, args, fn_span: _ } => {
|
||||
let fn_ty = func.ty(body, tcx);
|
||||
if let ty::FnDef(fn_def_id, _) = *fn_ty.kind() {
|
||||
if !is_const_fn(tcx, fn_def_id, msrv) {
|
||||
|
|
|
@ -96,11 +96,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
|
|||
return false;
|
||||
}
|
||||
|
||||
for (predicate, _span) in cx
|
||||
.tcx
|
||||
.explicit_item_super_predicates(def_id)
|
||||
.instantiate_identity_iter_copied()
|
||||
{
|
||||
for (predicate, _span) in cx.tcx.explicit_item_super_predicates(def_id).iter_identity_copied() {
|
||||
match predicate.kind().skip_binder() {
|
||||
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
|
||||
// and check substitutions to find `U`.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2024-06-27"
|
||||
channel = "nightly-2024-07-11"
|
||||
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
||||
profile = "minimal"
|
||||
|
|
|
@ -86,7 +86,6 @@ LL | dbg!();
|
|||
help: remove the invocation before committing it to a version control system
|
||||
|
|
||||
LL - dbg!();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: the `dbg!` macro is intended as a debugging tool
|
||||
|
@ -146,7 +145,6 @@ LL | expand_to_dbg!();
|
|||
help: remove the invocation before committing it to a version control system
|
||||
|
|
||||
LL - dbg!();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: the `dbg!` macro is intended as a debugging tool
|
||||
|
|
|
@ -9,7 +9,6 @@ LL | dbg!();
|
|||
help: remove the invocation before committing it to a version control system
|
||||
|
|
||||
LL - dbg!();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: the `dbg!` macro is intended as a debugging tool
|
||||
|
|
|
@ -96,12 +96,10 @@ LL | let (l, r) = "a.b.c".split_once('.').unwrap();
|
|||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let l = iter.next().unwrap();
|
||||
LL +
|
||||
|
|
||||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let r = iter.next().unwrap();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: manual implementation of `split_once`
|
||||
|
@ -121,12 +119,10 @@ LL | let (l, r) = "a.b.c".split_once('.')?;
|
|||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let l = iter.next()?;
|
||||
LL +
|
||||
|
|
||||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let r = iter.next()?;
|
||||
LL +
|
||||
|
|
||||
|
||||
error: manual implementation of `rsplit_once`
|
||||
|
@ -146,12 +142,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.').unwrap();
|
|||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let r = iter.next().unwrap();
|
||||
LL +
|
||||
|
|
||||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let l = iter.next().unwrap();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: manual implementation of `rsplit_once`
|
||||
|
@ -171,12 +165,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.')?;
|
|||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let r = iter.next()?;
|
||||
LL +
|
||||
|
|
||||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let l = iter.next()?;
|
||||
LL +
|
||||
|
|
||||
|
||||
error: manual implementation of `split_once`
|
||||
|
@ -202,12 +194,10 @@ LL | let (a, b) = "a.b.c".split_once('.').unwrap();
|
|||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let a = iter.next().unwrap();
|
||||
LL +
|
||||
|
|
||||
help: remove the `iter` usages
|
||||
|
|
||||
LL - let b = iter.next().unwrap();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: aborting due to 19 previous errors
|
||||
|
|
|
@ -104,15 +104,18 @@ fn main() {}
|
|||
|
||||
struct D;
|
||||
|
||||
/* FIXME(effects)
|
||||
impl const Drop for D {
|
||||
fn drop(&mut self) {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Lint this, since it can be dropped in const contexts
|
||||
// FIXME(effects)
|
||||
fn d(this: D) {}
|
||||
const fn d(this: D) {}
|
||||
//~^ ERROR: this could be a `const fn`
|
||||
|
||||
mod msrv {
|
||||
struct Foo(*const u8, &'static u8);
|
||||
|
|
|
@ -104,15 +104,18 @@ fn main() {}
|
|||
|
||||
struct D;
|
||||
|
||||
/* FIXME(effects)
|
||||
impl const Drop for D {
|
||||
fn drop(&mut self) {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Lint this, since it can be dropped in const contexts
|
||||
// FIXME(effects)
|
||||
fn d(this: D) {}
|
||||
//~^ ERROR: this could be a `const fn`
|
||||
|
||||
mod msrv {
|
||||
struct Foo(*const u8, &'static u8);
|
||||
|
|
|
@ -157,7 +157,18 @@ LL | const fn msrv_1_46() -> i32 {
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:122:9
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:117:1
|
||||
|
|
||||
LL | fn d(this: D) {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: make the function `const`
|
||||
|
|
||||
LL | const fn d(this: D) {}
|
||||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:125:9
|
||||
|
|
||||
LL | / fn deref_ptr_can_be_const(self) -> usize {
|
||||
LL | |
|
||||
|
@ -171,7 +182,7 @@ LL | const fn deref_ptr_can_be_const(self) -> usize {
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:127:9
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:130:9
|
||||
|
|
||||
LL | / fn deref_copied_val(self) -> usize {
|
||||
LL | |
|
||||
|
@ -185,7 +196,7 @@ LL | const fn deref_copied_val(self) -> usize {
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:138:5
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:141:5
|
||||
|
|
||||
LL | / fn union_access_can_be_const() {
|
||||
LL | |
|
||||
|
@ -200,7 +211,7 @@ LL | const fn union_access_can_be_const() {
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:146:9
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:149:9
|
||||
|
|
||||
LL | extern "C" fn c() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -211,7 +222,7 @@ LL | const extern "C" fn c() {}
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:150:9
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:153:9
|
||||
|
|
||||
LL | extern fn implicit_c() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -222,7 +233,7 @@ LL | const extern fn implicit_c() {}
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:167:9
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:170:9
|
||||
|
|
||||
LL | / pub fn new(strings: Vec<String>) -> Self {
|
||||
LL | | Self { strings }
|
||||
|
@ -235,7 +246,7 @@ LL | pub const fn new(strings: Vec<String>) -> Self {
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:172:9
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:175:9
|
||||
|
|
||||
LL | / pub fn empty() -> Self {
|
||||
LL | | Self { strings: Vec::new() }
|
||||
|
@ -248,7 +259,7 @@ LL | pub const fn empty() -> Self {
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:183:9
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:186:9
|
||||
|
|
||||
LL | / pub fn new(text: String) -> Self {
|
||||
LL | | let vec = Vec::new();
|
||||
|
@ -262,7 +273,7 @@ LL | pub const fn new(text: String) -> Self {
|
|||
| +++++
|
||||
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:202:5
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:205:5
|
||||
|
|
||||
LL | fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -272,5 +283,5 @@ help: make the function `const`
|
|||
LL | const fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
|
||||
| +++++
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
error: aborting due to 21 previous errors
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ fn or_fun_call() {
|
|||
|
||||
let opt = Some(1);
|
||||
let hello = "Hello";
|
||||
let _ = opt.ok_or(format!("{} world.", hello));
|
||||
let _ = opt.ok_or_else(|| format!("{} world.", hello));
|
||||
|
||||
// index
|
||||
let map = HashMap::<u64, u64>::new();
|
||||
|
|
|
@ -100,6 +100,12 @@ error: use of `unwrap_or` to construct default value
|
|||
LL | let _ = stringy.unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: use of `ok_or` followed by a function call
|
||||
--> tests/ui/or_fun_call.rs:101:17
|
||||
|
|
||||
LL | let _ = opt.ok_or(format!("{} world.", hello));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> tests/ui/or_fun_call.rs:105:21
|
||||
|
|
||||
|
@ -190,5 +196,5 @@ error: use of `unwrap_or_else` to construct default value
|
|||
LL | let _ = stringy.unwrap_or_else(String::new);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
||||
|
||||
error: aborting due to 31 previous errors
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ LL + let rslt0 = mutex.lock().unwrap().abs();
|
|||
help: remove separated single usage
|
||||
|
|
||||
LL - let rslt0 = lock.abs();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: temporary with significant `Drop` can be early dropped
|
||||
|
@ -88,7 +87,6 @@ LL + mutex.lock().unwrap().clear();
|
|||
help: remove separated single usage
|
||||
|
|
||||
LL - lock.clear();
|
||||
LL +
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
Loading…
Reference in a new issue