mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 08:13:37 +08:00
fix(extract): test the empty Rust impl name before the cut
cppcheck 2.20 reports the post-cut `if (!name[0])` as always false (knownConditionTrueFalse): it cannot see that writing through `lt` may empty `name`. The name is non-empty here, so the cut empties it only when `<` is the first character. Test exactly that before the cut. The behaviour is unchanged. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
@@ -1166,12 +1166,12 @@ static const char *compute_class_qn(CBMExtractCtx *ctx, TSNode node, const WalkS
|
||||
* and all its calls fall back to the File node. */
|
||||
if (ctx->language == CBM_LANG_RUST && strcmp(ts_node_type(node), "impl_item") == 0) {
|
||||
char *lt = strchr(name, '<');
|
||||
if (lt == name) {
|
||||
return NULL; /* `<T as Tr>`-style self type: no name to scope by */
|
||||
}
|
||||
if (lt) {
|
||||
*lt = '\0';
|
||||
}
|
||||
if (!name[0]) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Nested class: prefix with the enclosing class QN (Outer.Inner) so this
|
||||
|
||||
Reference in New Issue
Block a user