is_some_and taking self demo#99087
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in need_type_info.rs cc @lcnr Some changes occurred in src/tools/clippy cc @rust-lang/clippy Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred in src/librustdoc/clean/types.rs cc @camelid |
flip1995
left a comment
There was a problem hiding this comment.
There are some formatting-only changes in the Clippy files. Please don't commit those. I think I left a comment for each of those changes.
|
|
||
| fn check_crate_post(&mut self, cx: &EarlyContext<'_>, _: &Crate) { | ||
| for Modules { local_path, spans, lint_levels } in self.modules.values() { | ||
| for Modules { |
There was a problem hiding this comment.
AFAICT all changes in this file are formatting changes. Please don't commit formatting changes to Clippy.
| if is_type_diagnostic_item(cx, ty, sym::String) | ||
| || (is_type_lang_item(cx, ty, LangItem::OwnedBox) && get_ty_param(ty).map_or(false, Ty::is_str)) | ||
| || (match_type(cx, ty, &paths::COW) && get_ty_param(ty).map_or(false, Ty::is_str)) | ||
| || (is_type_lang_item(cx, ty, LangItem::OwnedBox) && get_ty_param(ty).is_some_and(|ty| ty.is_str())) |
There was a problem hiding this comment.
Wait, shouldn't
| || (is_type_lang_item(cx, ty, LangItem::OwnedBox) && get_ty_param(ty).is_some_and(|ty| ty.is_str())) | |
| || (is_type_lang_item(cx, ty, LangItem::OwnedBox) && get_ty_param(ty).is_some_and(Ty::is_str) |
still work?
| use rustc_lint::{LateContext, LintContext}; | ||
| use rustc_middle::lint::in_external_macro; | ||
| use rustc_middle::ty::{self, Ty, TypeVisitable, TypeSuperVisitable, TypeVisitor}; | ||
| use rustc_middle::ty::{self, Ty, TypeSuperVisitable, TypeVisitable, TypeVisitor}; |
| sp: Span, | ||
| msg: &str, | ||
| ) { | ||
| pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) { |
| PtrSimplifiedType, SliceSimplifiedType, StrSimplifiedType, UintSimplifiedType, | ||
| }; | ||
| use rustc_middle::ty::{layout::IntegerExt, BorrowKind, DefIdTree, Ty, TyCtxt, TypeAndMut, TypeVisitable, UpvarCapture}; | ||
| use rustc_middle::ty::{ |
|
@flip1995 sorry this PR is not intended to be merged. But fwiw the formatting changes are made with |
This then probably uses the |
No I run it manually when I make Clippy changes to avoid making changes that will be re-formatted. Any unrelated formatting changes that occur I assume are from rustc PR's that occurred since that last clippy sync. I usually don't push the unrelated formatting changes, but keep them in a commit in my local branch while working so that I don't see those changes every time I run |
|
☔ The latest upstream changes (presumably #99203) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@camsteffen I'd be happy to r+ a non-draft version of this; I think we've settled the question of taking self. |
|
@joshtriplett I reopened #98354. |
This is just to demo the difference between
&selfandselfas requested. The last commit "Fix is_some_and usages taking by value" is the interesting one.r? @joshtriplett