Skip to content

Commit a01af3d

Browse files
committed
Rust: Improve a few toString implementations
1 parent aa9d299 commit a01af3d

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,9 @@ module Impl {
3636
predicate isInReturnPos() {
3737
exists(Function f | f.getRetType().getTypeRepr() = this.getFunctionTypeRepr(f))
3838
}
39+
40+
override string toStringImpl() {
41+
result = "impl " + this.getTypeBoundList().toAbbreviatedString()
42+
}
3943
}
4044
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ module Impl {
2222
* ```
2323
*/
2424
class Lifetime extends Generated::Lifetime {
25-
override string toStringImpl() {
25+
override string toStringImpl() { result = this.toAbbreviatedString() }
26+
27+
override string toAbbreviatedString() {
2628
result = this.getText()
2729
or
2830
not this.hasText() and result = "'_"

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

Lines changed: 8 additions & 1 deletion
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/TypeBoundListImpl.qll

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

0 commit comments

Comments
 (0)