Skip to content

Commit

Permalink
refactor(code): simplify "attr_tsync" function
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Nov 2, 2023
1 parent 5062ebe commit 3e54f54
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,18 @@ impl<'a> Struct<'a> {
self.has_fields.unwrap()
}

/// Assemble the `tsync` attribute for the struct
fn attr_tsync(&self) -> &'static str {
#[cfg(feature = "tsync")]
match self.opts.get_tsync() {
true => "#[tsync::tsync]\n",
false => "",
if self.opts.get_tsync() {
return "#[tsync::tsync]\n";
}
#[cfg(not(feature = "tsync"))]

// default for no feature "tsync" and not being enabled at runtime
""
}

/// Assemble all derives for the struct
/// Assemble the `derive` attribute for the struct
fn attr_derive(&self) -> String {
let mut derives_vec = Vec::with_capacity(10);
// Default derives that exist on every struct
Expand Down

0 comments on commit 3e54f54

Please sign in to comment.