Conversation
|
Sadly, I accidentally deleted the branch connected to my previous PR, causing it to close. @ada4a |
|
Lintcheck changes for 0ba3dd7
This comment will be updated if you push new changes |
Happens to the best of us, don't worry... Looking at Lintcheck, there seem to be some classes of cases where we don't really want to lint:
|
I'm not sure I understand the comment about lintcheck. can you clarify please? This is based on issue 1810. |
|
Ah, sorry. Lintcheck is a thing where the PR is run on a bunch of popular crates, in order to see if the lint is doing the right thing, and catch false positives. You can see its results in #16677 (comment) by clicking on the |
|
in the changelog message, the lint name should be in backticks ( |
|
My latest update passes most tests, but the clippy test complains about collapsing my span_lint_and_then call into one (?) line. cargo dev fmt has a different idea. How does this get resolved? On the other front, it now supports debug_assert!() as well as assert!(). I also improved the handling of Or. |
Ah no, it also suggests switching to span_lint_and_sugg(cx, ASSERT_MULTIPLE, e.span, "multiple asserts combined into one", "consider writing", am_visitor.suggests.join("\n"), Applicability::MaybeIncorrect) |
|
Also, I'm not sure how you ended up putting a bunch of other people's commits onto your branch?.. Try |
|
@ada4a Any comments? |
|
Sorry, hadn't had the time to look at this yet, I'll probably do so tomorrow |
|
Reminder, once the PR becomes ready for a review, use |
|
rustbot has assigned @samueltardieu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
a2a87e5 to
ad6b9e2
Compare
395208a to
cd4357a
Compare
You can go one step further and store its
Right. I'm pretty sure the reason for this is that your diff --git i/clippy_lints/src/assert_multiple.rs w/clippy_lints/src/assert_multiple.rs
index dae19fc07..007d1d3e1 100644
--- i/clippy_lints/src/assert_multiple.rs
+++ w/clippy_lints/src/assert_multiple.rs
@@ -1,6 +1,6 @@
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::macros::{find_assert_args, root_macro_call_first_node};
-use clippy_utils::source::{snippet, snippet_indent, snippet_with_context};
+use clippy_utils::source::{snippet_indent, snippet_with_context};
use rustc_errors::Applicability;
use rustc_hir::intravisit::Visitor;
use rustc_hir::{BinOpKind, Expr, ExprKind, UnOp};
@@ -56,8 +56,8 @@ impl<'tcx> Visitor<'tcx> for AssertVisitor<'tcx, '_> {
let mut app = Applicability::MaybeIncorrect;
match e.kind {
ExprKind::Binary(op, lhs, rhs) => {
- let lhs_name = snippet(self.cx, lhs.span, "..");
- let rhs_name = snippet(self.cx, rhs.span, "..");
+ let lhs_name = snippet_with_context(self.cx, lhs.span, self.outerexp.span.ctxt(), "..", &mut app).0;
+ let rhs_name = snippet_with_context(self.cx, rhs.span, self.outerexp.span.ctxt(), "..", &mut app).0;
match op.node {
BinOpKind::And => {
@@ -113,7 +113,7 @@ impl<'tcx> LateLintPass<'tcx> for AssertMultiple {
cx,
suggests: Vec::new(),
assert_string,
- outerexp: e,
+ outerexp: condition,
};
rustc_hir::intravisit::walk_expr(&mut am_visitor, condition);For what it's worth, (correct) macro handling is one of the most challenging parts of Clippy, so picking an
You could use |
b3d615f to
0b3cd6a
Compare
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
91f5f34 to
b5e7234
Compare
This comment has been minimized.
This comment has been minimized.
Could you please address this one as well? Why do you write |
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
8121b8b to
1df9b49
Compare
Fixed. I think I lost that change in trying to rebase my branch in the previous changes, and failed to recheck that. More care this time. BTW. you mentioned this might not have been the best first project to try--it was flagged as "good first issue". |
|
The pull request says there is a change requested by reviewers with write access. I'm having trouble locating that change request. The message has been around for quite a while. Otherwise, I think I'm caught up. |
Ah okay, thank you for clearing that up:)
That's.. unfortunate. Fwiw that's an older issue -- a lot of the processes surrounding contribution were in infancy at that time.
It's just because I kind of gave up on Github's review UI, as we saw it was kind of flaky (with messages getting lost etc.). Feel free to ignore, I'll approve at the end. |
fca1ab3 to
e1039da
Compare
Apply suggestions from code review Co-authored-by: Ada Alakbarova <58857108+ada4a@users.noreply.github.com>
e1039da to
0ba3dd7
Compare
|
@rustbot ready |
View all comments
Closes #1810
changelog: [
assert_multiple]: Add a lint for asserts with multiple boolean tests