Skip to content

Commit 5012332

Browse files
author
Paolo Tranquilli
committed
Rust: fix Path.toString and address some review comments
1 parent d609c1b commit 5012332

File tree

82 files changed

+261
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+261
-127
lines changed

rust/ql/.generated.list

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/.gitattributes

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/Path.qll

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/PathSegment.qll

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/internal/BreakExprImpl.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ module Impl {
104104
)
105105
}
106106

107-
override string toString() { result = concat(int i | | this.toStringPart(i), " " order by i) }
107+
override string toString() {
108+
result = strictconcat(int i | | this.toStringPart(i), " " order by i)
109+
}
108110

109111
private string toStringPart(int index) {
110112
index = 0 and result = "break"

rust/ql/lib/codeql/rust/elements/internal/CastExprImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Impl {
2020
*/
2121
class CastExpr extends Generated::CastExpr {
2222
override string toString() {
23-
result = this.getExpr().toAbbreviatedString() + " as " + this.getTy().toString()
23+
result = this.getExpr().toAbbreviatedString() + " as " + this.getTy().toAbbreviatedString()
2424
}
2525
}
2626
}

rust/ql/lib/codeql/rust/elements/internal/ContinueExprImpl.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ module Impl {
4949
* ```
5050
*/
5151
class ContinueExpr extends Generated::ContinueExpr {
52-
override string toString() { result = concat(int i | | this.toStringPart(i), " " order by i) }
52+
override string toString() {
53+
result = strictconcat(int i | | this.toStringPart(i), " " order by i)
54+
}
5355

5456
private string toStringPart(int index) {
5557
index = 0 and result = "continue"
5658
or
57-
index = 1 and result = this.getLifetime().toString()
59+
index = 1 and result = this.getLifetime().getText()
5860
}
5961

6062
/**

rust/ql/lib/codeql/rust/elements/internal/EnumImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ module Impl {
1919
* ```
2020
*/
2121
class Enum extends Generated::Enum {
22-
override string toString() { result = "enum " + this.getName().toString() }
22+
override string toString() { result = "enum " + this.getName().getText() }
2323
}
2424
}

rust/ql/lib/codeql/rust/elements/internal/FieldExprImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Impl {
2222
override string toString() {
2323
exists(string abbr, string name |
2424
abbr = this.getExpr().toAbbreviatedString() and
25-
name = this.getNameRef().toString() and
25+
name = this.getNameRef().getText() and
2626
if abbr = "..." then result = "... ." + name else result = abbr + "." + name
2727
)
2828
}

rust/ql/lib/codeql/rust/elements/internal/ImplImpl.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ module Impl {
2222
override string toString() {
2323
exists(string trait |
2424
(
25-
trait = this.getTrait().toString() + " for "
25+
trait = this.getTrait().toAbbreviatedString() + " for "
2626
or
2727
not this.hasTrait() and trait = ""
2828
) and
29-
result = "impl " + trait + this.getSelfTy().toString() + " { ... }"
29+
result = "impl " + trait + this.getSelfTy().toAbbreviatedString() + " { ... }"
3030
)
3131
}
3232
}

0 commit comments

Comments
 (0)