Cargo fmt inconsistency?
⚓ Rust 📅 2026-05-06 👤 surdeus 👁️ 1This isn't important, but I am puzzled by why cargo fmt wants to put a load of parameters on different lines here, but in the previous function further up it is quite happy to have lots on the same line.
/// Draw image on page.
pub fn draw(&self, page: &mut Page, x: f32, y: f32, scale: f32) {
let obj = self.obj;
let w = (self.width as f32) * scale;
let h = (self.height as f32) * scale;
page.xobjs.insert(obj);
let _ = wb!(
&mut page.os,
b"\nq {} 0 0 {} {} {} cm /X{} Do Q",
w,
h,
x,
y,
obj
);
}
The function before:
let _ = wb!(
&mut w.b,
b"<</Type/XObject/Subtype/Image/Width {}/Height {}/ColorSpace{}/BitsPerComponent {}/Length {}{}>>stream\n",
s.width, s.height, s.color_space, s.bits_per_component, s.data.len(), s.other
);
2 posts - 2 participants
🏷️ Rust_feed