From bd841e77203aa804cfcb5c3d86bc6f15db009a07 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Mon, 22 Sep 2025 04:00:31 +0700 Subject: [PATCH] [docs] explain ignoring unused-ignoremore explicitly --- docs/source/error_code_list2.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/source/error_code_list2.rst b/docs/source/error_code_list2.rst index 125671bc2bef..4b1b52ba3de2 100644 --- a/docs/source/error_code_list2.rst +++ b/docs/source/error_code_list2.rst @@ -481,9 +481,12 @@ Example: # Error: unused "type: ignore" comment return a + b # type: ignore -Note that due to a specific nature of this comment, the only way to selectively -silence it, is to include the error code explicitly. Also note that this error is -not shown if the ``# type: ignore`` is not used due to code being statically +Mypy errors can typically be silenced by putting a ``# type: ignore`` comment after them, +but because this is *already* a ``# type: ignore`` comment, the only way to selectively +silence it is to include the error code explicitly, making the comment +``# type: ignore[unused-ignore]``. + +This error is not shown if the ``# type: ignore`` is not used due to code being statically unreachable (e.g. due to platform or version checks). Example: