Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Dec 12, 2024
1 parent 120963b commit fcf8f8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 7 additions & 4 deletions pyo3-stub-gen-derive/src/gen_stub/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ impl ToTokens for PyClassInfo {
bases,
} = self;
let module = quote_option(module);
let bases: Vec<_> = bases.into_iter().map(|(mod_, name)| {
let mod_ = quote_option(mod_);
quote! { (#mod_, #name) }
}).collect();
let bases: Vec<_> = bases
.into_iter()
.map(|(mod_, name)| {
let mod_ = quote_option(mod_);
quote! { (#mod_, #name) }
})
.collect();
tokens.append_all(quote! {
::pyo3_stub_gen::type_info::PyClassInfo {
pyclass_name: #pyclass_name,
Expand Down
8 changes: 6 additions & 2 deletions pyo3-stub-gen/src/generate/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ impl From<&PyClassInfo> for ClassDef {

impl fmt::Display for ClassDef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let bases = self.bases
let bases = self
.bases
.into_iter()
.map(|(m, n)| m.map(|m| format!("{m}.{n}")).unwrap_or_else(|| n.to_string()))
.map(|(m, n)| {
m.map(|m| format!("{m}.{n}"))
.unwrap_or_else(|| n.to_string())
})
.reduce(|acc, path| format!("{acc}, {path}"))
.map(|bases| format!("({bases})"))
.unwrap_or_default();
Expand Down

0 comments on commit fcf8f8d

Please sign in to comment.