expand `use instead` examples

This commit is contained in:
Brent Westbrook 2025-10-02 13:33:01 -04:00
parent 2caf2987c0
commit e3d26e1a62
1 changed files with 13 additions and 1 deletions

View File

@ -20,11 +20,23 @@ use crate::{FixAvailability, Violation};
/// from typing import ByteString
/// ```
///
/// Use instead:
/// On Python versions after 3.12, use the `Buffer` type from the standard library instead:
/// ```python
/// from collections.abc import Buffer
/// ```
///
/// For earlier Python versions, you can use `typing_extensions`:
/// ```python
/// from typing_extensions import Buffer
/// ```
///
/// or a union:
/// ```python
/// from typing import Union
///
/// x: Union[bytes, bytearray, memoryview]
/// ```
///
/// ## References
/// - [Python documentation: The `ByteString` type](https://docs.python.org/3/library/typing.html#typing.ByteString)
#[derive(ViolationMetadata)]