-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is_some_and
taking self
demo
#99087
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -79,21 +79,29 @@ impl EarlyLintPass for DuplicateMod { | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT all changes in this file are formatting changes. Please don't commit formatting changes to Clippy.
@@ -37,8 +37,8 @@ fn parse_repeat_arg(cx: &LateContext<'_>, e: &Expr<'_>) -> Option<RepeatKind> { | |||
} else { | |||
let ty = cx.typeck_results().expr_ty(e); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -7,7 +7,7 @@ use rustc_hir::def::{DefKind, Res}; | |||
use rustc_hir::{Expr, ExprKind, PatKind, Stmt, StmtKind}; | |||
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}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting change.
sp: Span, | ||
msg: &str, | ||
) { | ||
pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting change.
@@ -93,7 +94,9 @@ use rustc_middle::ty::fast_reject::SimplifiedTypeGen::{ | |||
ArraySimplifiedType, BoolSimplifiedType, CharSimplifiedType, FloatSimplifiedType, IntSimplifiedType, | |||
PtrSimplifiedType, SliceSimplifiedType, StrSimplifiedType, UintSimplifiedType, | |||
}; | |||
use rustc_middle::ty::{layout::IntegerExt, BorrowKind, DefIdTree, Ty, TyCtxt, TypeAndMut, TypeVisitable, UpvarCapture}; | |||
use rustc_middle::ty::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting change.
@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
&self
andself
as requested. The last commit "Fix is_some_and usages taking by value" is the interesting one.r? @joshtriplett