Rust: Use just end locations for now, to avoid all false positive lines caused by attached comments.

This commit is contained in:
Geoffrey White
2024-10-02 16:54:02 +01:00
parent 8c87b66bea
commit 01abcf8537
5 changed files with 6 additions and 7 deletions

View File

@@ -47,11 +47,10 @@ class File extends Container, Impl::File {
exists(AstNode node, Location loc |
not node instanceof Comment and
not node instanceof SourceFile and
not node instanceof Item and // ignore Items for now as we're getting their locations wrong when a comment is attached
loc = node.getLocation()
|
node.getFile() = this and
line = [loc.getStartLine(), loc.getEndLine()] and
line = [/*loc.getStartLine(), */loc.getEndLine()] and // ignore start locations for now as we're getting them wrong for things with a comment attached
not loc instanceof EmptyLocation
)
)

View File

@@ -1 +1 @@
| 68 |
| 61 |

View File

@@ -1 +1 @@
| 68 |
| 61 |

View File

@@ -1,5 +1,5 @@
| comments.rs:0:0:0:0 | comments.rs | 20 |
| my_struct.rs:0:0:0:0 | my_struct.rs | 20 |
| comments.rs:0:0:0:0 | comments.rs | 13 |
| main.rs:0:0:0:0 | main.rs | 8 |
| lib.rs:0:0:0:0 | lib.rs | 7 |
| my_macro.rs:0:0:0:0 | my_macro.rs | 7 |

View File

@@ -1,5 +1,5 @@
| Elements extracted | 290 |
| Elements unextracted | 0 |
| Files extracted | 7 |
| Lines of code extracted | 68 |
| Lines of user code extracted | 68 |
| Lines of code extracted | 61 |
| Lines of user code extracted | 61 |