diff --git a/crates/typst/src/model/bibliography.rs b/crates/typst/src/model/bibliography.rs index b7a10b923..9fcaad062 100644 --- a/crates/typst/src/model/bibliography.rs +++ b/crates/typst/src/model/bibliography.rs @@ -105,8 +105,7 @@ pub struct BibliographyElem { /// The bibliography's heading will not be numbered by default, but you can /// force it to be with a show-set rule: /// `{show bibliography: set heading(numbering: "1.")}` - #[default(Some(Smart::Auto))] - pub title: Option>, + pub title: Smart>, /// Whether to include all works from the given bibliography files, even /// those that weren't cited in the document. @@ -213,11 +212,9 @@ impl Show for Packed { const INDENT: Em = Em::new(1.5); let mut seq = vec![]; - if let Some(title) = self.title(styles) { - let title = title.unwrap_or_else(|| { - TextElem::packed(Self::local_name_in(styles)).spanned(self.span()) - }); - + if let Some(title) = self.title(styles).unwrap_or_else(|| { + Some(TextElem::packed(Self::local_name_in(styles)).spanned(self.span())) + }) { seq.push( HeadingElem::new(title) .with_level(Smart::Custom(NonZeroUsize::ONE)) diff --git a/crates/typst/src/model/outline.rs b/crates/typst/src/model/outline.rs index e92306567..2cf574cee 100644 --- a/crates/typst/src/model/outline.rs +++ b/crates/typst/src/model/outline.rs @@ -73,8 +73,7 @@ pub struct OutlineElem { /// The outline's heading will not be numbered by default, but you can /// force it to be with a show-set rule: /// `{show outline: set heading(numbering: "1.")}` - #[default(Some(Smart::Auto))] - pub title: Option>, + pub title: Smart>, /// The type of element to include in the outline. /// @@ -193,11 +192,9 @@ impl Show for Packed { fn show(&self, engine: &mut Engine, styles: StyleChain) -> SourceResult { let mut seq = vec![ParbreakElem::new().pack()]; // Build the outline title. - if let Some(title) = self.title(styles) { - let title = title.unwrap_or_else(|| { - TextElem::packed(Self::local_name_in(styles)).spanned(self.span()) - }); - + if let Some(title) = self.title(styles).unwrap_or_else(|| { + Some(TextElem::packed(Self::local_name_in(styles)).spanned(self.span())) + }) { seq.push( HeadingElem::new(title) .with_depth(NonZeroUsize::ONE)