Rust: improve performance of Crate::toString

This commit is contained in:
Arthur Baars
2025-03-11 12:34:59 +01:00
parent 66ab3a8002
commit 3991dc3aa3

View File

@@ -12,8 +12,18 @@ private import codeql.rust.elements.internal.generated.Crate
*/
module Impl {
class Crate extends Generated::Crate {
override string toString() {
result = "Crate(" + this.getName() + "@" + concat(this.getVersion()) + ")"
override string toString() { result = strictconcat(int i | | this.toStringPart(i) order by i) }
private string toStringPart(int i) {
i = 0 and result = "Crate("
or
i = 1 and result = this.getName()
or
i = 2 and result = "@"
or
i = 3 and result = this.getVersion()
or
i = 4 and result = ")"
}
}
}