Skip to content

Commit 7005c73

Browse files
committed
Further simplify source_builder.rs
1 parent ff86972 commit 7005c73

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

generate/src/source_builder.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -241,29 +241,10 @@ impl Module {
241241

242242
fn write_fns(&self, file: &mut File) -> Result<()> {
243243
for (qualified_struct_wrapper, fns) in &self.fns {
244+
assert!(qualified_struct_wrapper.is_empty());
244245
writeln!(file)?;
245-
let common_attrs = if qualified_struct_wrapper.is_empty() {
246-
Vec::new()
247-
} else {
248-
self.common_attrs(qualified_struct_wrapper)
249-
};
250-
if !qualified_struct_wrapper.is_empty() {
251-
let attrs = self
252-
.struct_wrappers
253-
.get(qualified_struct_wrapper)
254-
.map(|struct_wrapper| struct_wrapper.attrs.clone())
255-
.unwrap_or_default();
256-
let (_, struct_wrapper) = qualified_struct_wrapper.extract_initial_path();
257-
let attrs = join_attrs(attrs.iter().chain(&common_attrs));
258-
writeln!(
259-
file,
260-
"{attrs}impl {} for {} {{",
261-
struct_wrapper.to_string(),
262-
qualified_struct_wrapper.to_string(),
263-
)?;
264-
}
265246
for Fn { attrs, sig, body } in fns {
266-
let attrs = join_attrs(&remove_common_attrs(attrs.clone(), &common_attrs));
247+
let attrs = join_attrs(attrs);
267248
writeln!(file, "{attrs}{sig} {{{body}}}")?;
268249
}
269250
if !qualified_struct_wrapper.is_empty() {

0 commit comments

Comments
 (0)