diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-01-15 15:19:05 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2024-01-15 15:19:59 +0100 |
| commit | f57c34a7ce7bd09d7c2f2d19f37645ad30493afd (patch) | |
| tree | ac607cf7ff262a9c13ee497a396406e0b3310bfd /crates | |
| parent | 213bf36a052ff9cebe1fddbc8ea2fcc62a2c25ec (diff) | |
Remove inline annotations in main crate
Inline annotations only have an effect cross-crate and LTO is enabled anyway. Benchmarks don't show any performance difference.
Keeping them typst-syntax and typst-timing for now because these have a higher chance of being called cross-crate by crate consumers.
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/typst/src/eval/call.rs | 1 | ||||
| -rw-r--r-- | crates/typst/src/foundations/content.rs | 13 | ||||
| -rw-r--r-- | crates/typst/src/foundations/label.rs | 2 | ||||
| -rw-r--r-- | crates/typst/src/layout/inline/shaping.rs | 7 | ||||
| -rw-r--r-- | crates/typst/src/util/scalar.rs | 1 | ||||
| -rw-r--r-- | crates/typst/src/visualize/color.rs | 1 |
6 files changed, 0 insertions, 25 deletions
diff --git a/crates/typst/src/eval/call.rs b/crates/typst/src/eval/call.rs index 3bdd9a46..379cc959 100644 --- a/crates/typst/src/eval/call.rs +++ b/crates/typst/src/eval/call.rs @@ -511,7 +511,6 @@ impl<'a> CapturesVisitor<'a> { } /// Capture a variable if it isn't internal. - #[inline] fn capture( &mut self, ident: &str, diff --git a/crates/typst/src/foundations/content.rs b/crates/typst/src/foundations/content.rs index e498c8cb..a0cb45cf 100644 --- a/crates/typst/src/foundations/content.rs +++ b/crates/typst/src/foundations/content.rs @@ -72,25 +72,21 @@ pub struct Content(Arc<dyn NativeElement>); impl Content { /// Creates a new content from an element. - #[inline] pub fn new<E: NativeElement>(elem: E) -> Self { Self(Arc::new(elem)) } /// Creates a new empty sequence content. - #[inline] pub fn empty() -> Self { Self::new(SequenceElem::default()) } /// Get the element of this content. - #[inline] pub fn elem(&self) -> Element { self.0.dyn_elem() } /// Get the span of the content. - #[inline] pub fn span(&self) -> Span { self.0.span() } @@ -102,7 +98,6 @@ impl Content { } /// Get the label of the content. - #[inline] pub fn label(&self) -> Option<Label> { self.0.label() } @@ -154,7 +149,6 @@ impl Content { /// This is the preferred way to access fields. However, you can only use it /// if you have set the field IDs yourself or are using the field IDs /// generated by the `#[elem]` macro. - #[inline] pub fn get(&self, id: u8) -> Option<Value> { self.0.field(id) } @@ -163,7 +157,6 @@ impl Content { /// /// If you have access to the field IDs of the element, use [`Self::get`] /// instead. - #[inline] pub fn get_by_name(&self, name: &str) -> Option<Value> { let id = self.elem().field_id(name)?; self.get(id) @@ -174,7 +167,6 @@ impl Content { /// This is the preferred way to access fields. However, you can only use it /// if you have set the field IDs yourself or are using the field IDs /// generated by the `#[elem]` macro. - #[inline] pub fn field(&self, id: u8) -> StrResult<Value> { self.get(id) .ok_or_else(|| missing_field(self.elem().field_name(id).unwrap())) @@ -185,7 +177,6 @@ impl Content { /// /// If you have access to the field IDs of the element, use [`Self::field`] /// instead. - #[inline] pub fn field_by_name(&self, name: &str) -> StrResult<Value> { let id = self.elem().field_id(name).ok_or_else(|| missing_field(name))?; self.field(id) @@ -415,7 +406,6 @@ impl Content { } /// Downcasts the element to the specified type. - #[inline] pub fn to<T: NativeElement>(&self) -> Option<&T> { // Early check for performance. if !self.is::<T>() { @@ -426,7 +416,6 @@ impl Content { } /// Downcasts mutably the element to the specified type. - #[inline] pub fn to_mut<T: NativeElement>(&mut self) -> Option<&mut T> { // Early check for performance. if !self.is::<T>() { @@ -437,7 +426,6 @@ impl Content { } /// Downcast the element into an owned value. - #[inline] pub fn unpack<T: NativeElement>(self) -> Option<Arc<T>> { // Early check for performance. if !self.is::<T>() { @@ -449,7 +437,6 @@ impl Content { /// Makes sure the content is not shared and returns a mutable reference to /// the inner element. - #[inline] fn make_mut(&mut self) -> &mut dyn NativeElement { let arc = &mut self.0; if Arc::strong_count(arc) > 1 || Arc::weak_count(arc) > 0 { diff --git a/crates/typst/src/foundations/label.rs b/crates/typst/src/foundations/label.rs index 9d84a564..78778359 100644 --- a/crates/typst/src/foundations/label.rs +++ b/crates/typst/src/foundations/label.rs @@ -42,13 +42,11 @@ impl Label { } /// Resolves the label to a string. - #[inline] pub fn as_str(&self) -> &'static str { self.0.resolve() } /// Turns this label into its inner interned string. - #[inline] pub fn into_inner(self) -> PicoStr { self.0 } diff --git a/crates/typst/src/layout/inline/shaping.rs b/crates/typst/src/layout/inline/shaping.rs index 07be8c68..28aee7bd 100644 --- a/crates/typst/src/layout/inline/shaping.rs +++ b/crates/typst/src/layout/inline/shaping.rs @@ -980,13 +980,11 @@ pub(super) fn is_gb_style(lang: Lang, region: Option<Region>) -> bool { } /// Whether the glyph is a space. -#[inline] fn is_space(c: char) -> bool { matches!(c, ' ' | '\u{00A0}' | ' ') } /// Whether the glyph is part of Chinese or Japanese script (i.e. CJ, not CJK). -#[inline] pub(super) fn is_of_cj_script(c: char) -> bool { is_cj_script(c, c.script()) } @@ -994,7 +992,6 @@ pub(super) fn is_of_cj_script(c: char) -> bool { /// Whether the glyph is part of Chinese or Japanese script (i.e. CJ, not CJK). /// The function is dedicated to typesetting Chinese or Japanese, which do not /// have spaces between words, so K is not checked here. -#[inline] fn is_cj_script(c: char, script: Script) -> bool { use Script::*; // U+30FC: Katakana-Hiragana Prolonged Sound Mark @@ -1002,7 +999,6 @@ fn is_cj_script(c: char, script: Script) -> bool { } /// See <https://www.w3.org/TR/clreq/#punctuation_width_adjustment> -#[inline] fn is_cjk_left_aligned_punctuation( c: char, x_advance: Em, @@ -1027,7 +1023,6 @@ fn is_cjk_left_aligned_punctuation( } /// See <https://www.w3.org/TR/clreq/#punctuation_width_adjustment> -#[inline] fn is_cjk_right_aligned_punctuation( c: char, x_advance: Em, @@ -1043,7 +1038,6 @@ fn is_cjk_right_aligned_punctuation( } /// See <https://www.w3.org/TR/clreq/#punctuation_width_adjustment> -#[inline] fn is_cjk_center_aligned_punctuation(c: char, gb_style: bool) -> bool { if !gb_style && matches!(c, ',' | '。' | '.' | '、' | ':' | ';') { return true; @@ -1060,7 +1054,6 @@ fn is_cjk_center_aligned_punctuation(c: char, gb_style: bool) -> bool { /// fullwidth. This heuristics can therefore fail for monospace latin fonts. /// However, since monospace fonts are usually not justified this edge case /// should be rare enough. -#[inline] fn is_justifiable( c: char, script: Script, diff --git a/crates/typst/src/util/scalar.rs b/crates/typst/src/util/scalar.rs index fbd2a28e..0fee9797 100644 --- a/crates/typst/src/util/scalar.rs +++ b/crates/typst/src/util/scalar.rs @@ -32,7 +32,6 @@ impl Scalar { } /// Gets the value of this [`Scalar`]. - #[inline] pub const fn get(self) -> f64 { self.0 } diff --git a/crates/typst/src/visualize/color.rs b/crates/typst/src/visualize/color.rs index a8b51cee..9a3fd5c3 100644 --- a/crates/typst/src/visualize/color.rs +++ b/crates/typst/src/visualize/color.rs @@ -1173,7 +1173,6 @@ impl Color { } /// Converts a 32-bit integer to an RGBA color. - #[inline] pub fn from_u32(color: u32) -> Self { Self::from_u8( ((color >> 24) & 0xFF) as u8, |
