-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use diagnostic or language items instead of paths #6823
Conversation
r? @phansch (rust-highfive has picked a reviewer for you, use r? to override) |
Minus the comments from @camsteffen, this looks good to me, thanks! |
woops, misclicked 😅 |
@bors r+ thanks! |
📌 Commit 11375b5 has been approved by |
Use diagnostic or language items instead of paths I think that gets everything except ones used in a list of paths to check. changelog: none
💔 Test failed - checks-action_test |
@bors r+ |
📌 Commit e4ffff9 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Is this expected to have a direct effect on lint results? Most of them seem to be caused by macro usage
#[allow(unused_macros)]
macro_rules! s {
($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($(
s!(it: $(#[$attr])* pub $t $i { $($field)* });
)*);
(it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => (
compile_error!("unions cannot derive extra traits, use s_no_extra_traits instead");
);
(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => (
__item! {
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
#[allow(deprecated)]
$(#[$attr])*
pub struct $i { $($field)* }
}
#[allow(deprecated)]
impl ::Copy for $i {}
#[allow(deprecated)]
impl ::Clone for $i { // <- HERE
fn clone(&self) -> $i { *self }
}
);
}
|
@@ -293,7 +293,7 @@ fn check_ord_partial_ord<'tcx>( | |||
|
|||
/// Implementation of the `EXPL_IMPL_CLONE_ON_COPY` lint. | |||
fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &TraitRef<'_>, ty: Ty<'tcx>) { | |||
if match_path(&trait_ref.path, &paths::CLONE_TRAIT) { | |||
if cx.tcx.lang_items().clone_trait() == trait_ref.trait_def_id() { |
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.
Maybe comparing def_id
s isn't equivalent to the match_path
method?
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.
The lang item might not be defined at the point. I didn't think that would actually happen though. I'll have a pr in a bit.
Turns out this did fix |
Yeah, I agree. Triggering in the above example makes sense to me. I also think triggering in local macros is fine. |
Don't assume lang items will exist. ~~Should fix lintcheck warnings caused by #6823~~ See below changelog: None
I think that gets everything except ones used in a list of paths to check.
changelog: none