Skip to content
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

dbg_macro ignored in macro call sites #12131

Closed
Wilfred opened this issue Jan 11, 2024 · 1 comment · Fixed by #12482
Closed

dbg_macro ignored in macro call sites #12131

Wilfred opened this issue Jan 11, 2024 · 1 comment · Fixed by #12482
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Jan 11, 2024

Summary

When dbg! is used inside another macro call, the dbg_macro lint doesn't fire.

Lint Name

dbg_macro

Reproducer

I tried this code:

#![warn(clippy::dbg_macro)]

fn foo(s: &str) {
    dbg!(s); // lint
}

fn foo2(s: &str) {
    format!("{}.rs", dbg!(s)); // no lint
}

I expected to see this happen: Both occurrences of dbg! produce a lint.

Instead, this happened: Only foo gets the lint.

Version

No response

@Wilfred Wilfred added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Jan 11, 2024
@J-ZhengLi
Copy link
Member

@rustbot claim

bors added a commit that referenced this issue Mar 6, 2024
fix [`dbg_macro`] FN when `dbg` is inside some complex macros

fixes: #12131

It appears that [`root_macro_call_first_node`] only detects `println!` in the following example:
```rust
println!("{:?}", dbg!(s));
```

---

changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
bors added a commit that referenced this issue Mar 6, 2024
fix [`dbg_macro`] FN when `dbg` is inside some complex macros

fixes: #12131

It appears that [`root_macro_call_first_node`] only detects `println!` in the following example:
```rust
println!("{:?}", dbg!(s));
```

---

changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
bors added a commit that referenced this issue Mar 7, 2024
fix [`dbg_macro`] FN when `dbg` is inside some complex macros

fixes: #12131

It appears that [`root_macro_call_first_node`] only detects `println!` in the following example:
```rust
println!("{:?}", dbg!(s));
```

---

changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
bors added a commit that referenced this issue Mar 7, 2024
fix [`dbg_macro`] FN when `dbg` is inside some complex macros

fixes: #12131

It appears that [`root_macro_call_first_node`] only detects `println!` in the following example:
```rust
println!("{:?}", dbg!(s));
```

---

changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
bors added a commit that referenced this issue Mar 7, 2024
fix [`dbg_macro`] FN when `dbg` is inside some complex macros

fixes: #12131

It appears that [`root_macro_call_first_node`] only detects `println!` in the following example:
```rust
println!("{:?}", dbg!(s));
```

---

changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
bors added a commit that referenced this issue Mar 12, 2024
fix [`dbg_macro`] FN when `dbg` is inside some complex macros

fixes: #12131

It appears that [`root_macro_call_first_node`] only detects `println!` in the following example:
```rust
println!("{:?}", dbg!(s));
```

---

changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
bors added a commit that referenced this issue Mar 12, 2024
fix [`dbg_macro`] FN when `dbg` is inside some complex macros

fixes: #12131

It appears that [`root_macro_call_first_node`] only detects `println!` in the following example:
```rust
println!("{:?}", dbg!(s));
```

---

changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
@bors bors closed this as completed in 12ecaa8 Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
2 participants