mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Include alias when formatting import-from structs (#5786)
## Summary When required-imports is set with the syntax from ... import ... as ..., autofix I002 is failing ## Test Plan Reuse the same python files as `crates/ruff/src/rules/isort/mod.rs:required_import` test.
This commit is contained in:
parent
8ccd697020
commit
6824b67f44
12 changed files with 171 additions and 0 deletions
|
@ -85,6 +85,9 @@ impl std::fmt::Display for ImportFrom<'_> {
|
|||
write!(f, "{module}")?;
|
||||
}
|
||||
write!(f, " import {}", self.name.name)?;
|
||||
if let Some(as_name) = self.name.as_name {
|
||||
write!(f, " as {as_name}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue