mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Indent wheels like dependencies in the lockfile (#4582)
This PR contains two style changes to the lockfile: * Always indent lists of objects, even with they are only a single element. * Use 4 spaces instead of tabs for indenting, to mirror what we do in the ruff formatter.
This commit is contained in:
parent
4c1181b9e1
commit
80e45d3174
5 changed files with 734 additions and 459 deletions
|
@ -448,24 +448,13 @@ impl Lock {
|
|||
}
|
||||
|
||||
if !dist.wheels.is_empty() {
|
||||
let wheels = dist
|
||||
.wheels
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, wheel)| {
|
||||
let mut table = wheel.to_toml()?;
|
||||
|
||||
if dist.wheels.len() > 1 {
|
||||
// Indent each wheel on a new line.
|
||||
table.decor_mut().set_prefix("\n\t");
|
||||
if i == dist.wheels.len() - 1 {
|
||||
table.decor_mut().set_suffix("\n");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(table)
|
||||
})
|
||||
.collect::<anyhow::Result<Array>>()?;
|
||||
let wheels = each_element_on_its_line_array(
|
||||
dist.wheels
|
||||
.iter()
|
||||
.map(Wheel::to_toml)
|
||||
.collect::<anyhow::Result<Vec<_>>>()?
|
||||
.into_iter(),
|
||||
);
|
||||
table.insert("wheels", value(wheels));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue