rules/polars/polars-lazy-schema-property.md

Polars 2.1.0 emits PerformanceWarning when code reads LazyFrame.schema. Use collect_schema to make schema resolution explicit.

diff
1-lf.schema
2+lf.collect_schema()

What the rule reports

FormReplacement exampleProof on 2.1.0
lf.schemalf.collect_schema()PerformanceWarning. The explicit replacement returned the same value and type.
lf.columnslf.collect_schema().names()PerformanceWarning. The explicit replacement returned the same value and type.
lf.dtypeslf.collect_schema().dtypes()PerformanceWarning. The explicit replacement returned the same value and type.
lf.widthlen(lf.collect_schema())PerformanceWarning. The explicit replacement returned the same value and type.

How to fix it

Use xpd check --fix to apply the safe rewrite when the report offers one.