diff --git a/coverage/control.py b/coverage/control.py index bce5f0a17..e051de828 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -258,7 +258,7 @@ def __init__( # pylint: disable=too-many-arguments self._warn_no_data = True self._warn_unimported_source = True self._warn_preimported_source = check_preimported - self._no_warn_slugs: list[str] = [] + self._no_warn_slugs: set[str] = set() self._messages = messages # A record of all the warnings that have been issued. @@ -438,7 +438,7 @@ def _warn(self, msg: str, slug: str | None = None, once: bool = False) -> None: """ if not self._no_warn_slugs: - self._no_warn_slugs = list(self.config.disable_warnings) + self._no_warn_slugs = set(self.config.disable_warnings) if slug in self._no_warn_slugs: # Don't issue the warning @@ -453,7 +453,7 @@ def _warn(self, msg: str, slug: str | None = None, once: bool = False) -> None: if once: assert slug is not None - self._no_warn_slugs.append(slug) + self._no_warn_slugs.add(slug) def _message(self, msg: str) -> None: """Write a message to the user, if configured to do so."""