diff --git a/crates/ruff_linter/src/rules/pylint/rules/bad_open_mode.rs b/crates/ruff_linter/src/rules/pylint/rules/bad_open_mode.rs index 0427bab652..b89cbf1425 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/bad_open_mode.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/bad_open_mode.rs @@ -24,13 +24,14 @@ use crate::checkers::ast::Checker; /// ## Example /// ```python /// with open("file", "rwx") as f: -/// return f.read() +/// content = f.read() /// ``` /// /// Use instead: +/// /// ```python /// with open("file", "r") as f: -/// return f.read() +/// content = f.read() /// ``` /// /// ## References diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/yield_in_for_loop.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/yield_in_for_loop.rs index e7f88cd553..8fa6118e4c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/yield_in_for_loop.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/yield_in_for_loop.rs @@ -15,21 +15,23 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// /// ## Example /// ```python -/// for x in foo: -/// yield x +/// def bar(): +/// for x in foo: +/// yield x /// -/// global y -/// for y in foo: -/// yield y +/// global y +/// for y in foo: +/// yield y /// ``` /// /// Use instead: /// ```python -/// yield from foo +/// def bar(): +/// yield from foo /// -/// for _element in foo: -/// y = _element -/// yield y +/// for _element in foo: +/// y = _element +/// yield y /// ``` /// /// ## Fix safety