Skip to content

Commit 0d292b7

Browse files
committed
Rust: remove reduntant Item superclass from Adt subclasses
1 parent 670b835 commit 0d292b7

File tree

13 files changed

+38
-65
lines changed

13 files changed

+38
-65
lines changed

misc/codegen/lib/schemadefs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,16 @@ def modify(self, prop: _schema.Property):
321321
def annotate(
322322
annotated_cls: type,
323323
add_bases: _Iterable[type] | None = None,
324-
replace_bases: _Dict[type, type] | None = None,
324+
replace_bases: _Dict[type, type | None] | None = None,
325325
cfg: bool = False,
326326
) -> _Callable[[type], _PropertyModifierList]:
327327
"""
328328
Add or modify schema annotations after a class has been defined previously.
329329
330330
The name of the class used for annotation must be `_`.
331331
332-
`replace_bases` can be used to replace bases on the annotated class.
332+
`replace_bases` can be used to replace bases on the annotated class. Mapping to
333+
`None` will remove that base class.
333334
"""
334335

335336
def decorator(cls: type) -> _PropertyModifierList:
@@ -341,7 +342,9 @@ def decorator(cls: type) -> _PropertyModifierList:
341342
_ClassPragma(p, value=v)(annotated_cls)
342343
if replace_bases:
343344
annotated_cls.__bases__ = tuple(
344-
replace_bases.get(b, b) for b in annotated_cls.__bases__
345+
b
346+
for b in (replace_bases.get(b, b) for b in annotated_cls.__bases__)
347+
if b is not None
345348
)
346349
if add_bases:
347350
annotated_cls.__bases__ += tuple(add_bases)

rust/ql/.generated.list

Lines changed: 9 additions & 9 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/Enum.qll

Lines changed: 0 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/Struct.qll

Lines changed: 0 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/Union.qll

Lines changed: 0 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/generated/Enum.qll

Lines changed: 1 addition & 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)