mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 21:04:18 +00:00
Merge pull request #20547 from ChayimFriedman2/highlight-related-unsafe-scope
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: In highlight_related, when on an unsafe block, don't highlight unsafe operations of other unsafe blocks
This commit is contained in:
commit
968fc01fa6
4 changed files with 44 additions and 10 deletions
|
|
@ -119,11 +119,11 @@ pub fn unsafe_operations(
|
|||
def: DefWithBodyId,
|
||||
body: &Body,
|
||||
current: ExprId,
|
||||
callback: &mut dyn FnMut(InsideUnsafeBlock),
|
||||
callback: &mut dyn FnMut(ExprOrPatId, InsideUnsafeBlock),
|
||||
) {
|
||||
let mut visitor_callback = |diag| {
|
||||
if let UnsafeDiagnostic::UnsafeOperation { inside_unsafe_block, .. } = diag {
|
||||
callback(inside_unsafe_block);
|
||||
if let UnsafeDiagnostic::UnsafeOperation { inside_unsafe_block, node, .. } = diag {
|
||||
callback(node, inside_unsafe_block);
|
||||
}
|
||||
};
|
||||
let mut visitor = UnsafeVisitor::new(db, infer, body, def, &mut visitor_callback);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue