◐ Shell
clean mode source ↗

Add `map_unwrap_or` clippy rule by ShaharNaveh · Pull Request #7829 · RustPython/RustPython

Workspace Lint Configuration
Cargo.toml, crates/codegen/src/compile.rs Enable map_unwrap_or Clippy lint and add #[expect] where applicable. Code Generation Pattern Matching
crates/codegen/src/compile.rs Refactor wildcard-pattern detection to use is_some_and() for star/match_as wildcard name checks. Code Generation IR Optimization
crates/codegen/src/ir.rs Replace map(...).unwrap_or(true) with is_none_or() for fallthrough detection; simplify debug/index computations with map_or/map_or_else. Symbol Table Scope Tracking
crates/codegen/src/symboltable.rs Use is_some_and() to compute nested-scope status from parent scope properties. Format Parsing and Class Derivation
crates/common/src/cformat.rs, crates/derive-impl/src/pyclass.rs Simplify error-index computation and base-name derivation using map_or()/map_or_else(). String & Regex Character Classification
crates/sre_engine/src/string.rs Modernize ASCII/Unicode classification and casing helpers using try_from(...).is_ok_and(...) and map_or(...). AsyncIO Repr Fallback
crates/stdlib/src/_asyncio.rs Use map_or_else() for future/task _state repr fallback. Opcode Instruction Handling
crates/stdlib/src/_opcode.rs Refactor stack_effect oparg defaulting and has_* predicates to map_or()/is_ok_and() patterns. Bisect Index Handling
crates/stdlib/src/bisect.rs Simplify lo/hi defaults and conversions using map_or(). CSV Reader Trimming
crates/stdlib/src/csv.rs Update trimmed-end computation to `map_or(0, Faulthandler Line/Handler Fallbacks
crates/stdlib/src/faulthandler.rs Refactor line-number fallback and saved-signal-handler retrieval using map_or()/map_or_else(). JSON Scanner Fallback Index
crates/stdlib/src/json.rs Use map_or() for end-byte fallback when char→byte mapping fails. Math.prod Float Init
crates/stdlib/src/math.rs Refactor float fast-path initialization using map_or(1.0, ...). Mmap Range & Read Calculations
crates/stdlib/src/mmap.rs Refactor get_find_range() and read() optional-parameter handling with map_or_else()/map_or(). SSL/TLS Option Handling
crates/stdlib/src/ssl.rs Modernize session-resume detection, non-blocking checks, buffer sizing, digit detection, and default-verify-path construction using is_some_and() and map_or*. SSL Compat Read Paths
crates/stdlib/src/ssl/compat.rs Simplify optional bytes-length extraction to map_or(0, ...) (merged into SSL layer). Float Parsing Error Path
crates/vm/src/builtins/float.rs Use map_or_else() to choose between propagating repr() errors or raising ValueError with repr text. Frame Line Number Fallbacks
crates/vm/src/builtins/frame.rs Simplify f_lineno() / set_f_lineno() fallback derivation using map_or(). Function Docstring Default
crates/vm/src/builtins/function.rs Use map_or_else() to extract docstring from constants or fallback to vm.ctx.none(). Sequence Iterator length_hint
crates/vm/src/builtins/iter.rs Refactor length-resolution to map_or_else() returning NotImplemented on failure. Module Shadowing Detection
crates/vm/src/builtins/module.rs Use is_some_and() to test module origin for possible stdlib shadowing. Object Reduction / Pickling
crates/vm/src/builtins/object.rs Construct kwargs dict via map_or_else() when reducing new objects. Singleton Comparison
crates/vm/src/builtins/singletons.rs Use map_or() for PyNone identical-optimization mapping. String Encoding & Lossy Conversion
crates/vm/src/builtins/str.rs Refactor encoding default and lossy conversion fallback with map_or()/map_or_else(). Template Interpolation Values
crates/vm/src/builtins/template.rs Simplify interpolation value extraction with map_or_else(). Type Slot Inheritance & Counts
crates/vm/src/builtins/type.rs Use and_then() for inherited slots and map_or() for member-count defaults. OS Error String Formatting
crates/vm/src/exceptions.rs Use map_or_else() to supply "None" defaults for missing errno/strerror conversions. Frame Execution & Instrumentation
crates/vm/src/frame.rs Modernize traceback conversion, exception-info stacking, instrumented-read fallbacks, import shadowing checks, and panic-message formatting. Virtualenv Path Config
crates/vm/src/getpath.rs Refactor venv prefix assignment using map_or_else() fallback to calculated prefix. Atomic Reference Pointer Conversions
crates/vm/src/object/ext.rs Replace map(...).unwrap_or(null_mut()) with map_or(null_mut(), ...) in PyAtomicRef From/swap implementations. AST Statement Serialization
crates/vm/src/stdlib/_ast/statement.rs Use map_or_else() for optional AST fields to produce empty-list defaults. Codec Argument Defaults
crates/vm/src/stdlib/_codecs.rs Simplify optional encoding and Windows errors defaults via map_or(). Deque Repr & Errors
crates/vm/src/stdlib/_collections.rs Refactor deque index error detail and repr maxlen closing via map_or_else(). ctypes Array & Wchar
crates/vm/src/stdlib/_ctypes/array.rs Use nested map_or() for element-size defaults and wchar first-codepoint extraction. ctypes Buffer→FFI Conversion
crates/vm/src/stdlib/_ctypes/base.rs Refactor byte extraction and boolean conversion using map_or()/is_some_and(). ctypes Function Results & Formats
crates/vm/src/stdlib/_ctypes/function.rs Modernize out-buffer result, buffer-format selection, flags defaulting, and callback repr fallback using map_or*/map_or_else(). ctypes Pointer & Simple Types
crates/vm/src/stdlib/_ctypes/pointer.rs, .../simple.rs Produce format Cow via map_or(...) to select borrowed default or owned Cow. functools.partial Dict & Repr
crates/vm/src/stdlib/_functools.rs Refactor __dict__ getter and qualname wtf8 conversion with map_or_else(). I/O Size & Repr Fallback
crates/vm/src/stdlib/_io.rs Simplify optional size conversion and file-repr fallback with map_or()/map_or_else(). re.Match Group Values
crates/vm/src/stdlib/_sre.rs Refactor group, groups, and groupdict to use map_or_else() for missing slices. TypeAlias Param Error Fallback
crates/vm/src/stdlib/_typing.rs Use map_or_else() for param repr fallbacks in error messages. Builtins build_class Metaclass
crates/vm/src/stdlib/builtins.rs Refactor metaclass kwarg extraction via map_or_else() while preserving downcast/default behaviors. Type Slot Hash Wrapper Fallback
crates/vm/src/types/slot.rs Select fix_sentinel or hash_bigint fallback via map_or_else(). Warning Registry Version Matching
crates/vm/src/warn.rs Use is_ok_and() to detect saved filters-version matching current filters_version.