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.
This commit is contained in:
Laurenz 2024-01-15 15:19:05 +01:00
parent 213bf36a05
commit f57c34a7ce
6 changed files with 0 additions and 25 deletions

View File

@ -511,7 +511,6 @@ impl<'a> CapturesVisitor<'a> {
}
/// Capture a variable if it isn't internal.
#[inline]
fn capture(
&mut self,
ident: &str,

View File

@ -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 {

View File

@ -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
}

View File

@ -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,

View File

@ -32,7 +32,6 @@ impl Scalar {
}
/// Gets the value of this [`Scalar`].
#[inline]
pub const fn get(self) -> f64 {
self.0
}

View File

@ -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,