Use #[inline(always)] only when relatively certain.

This commit is contained in:
Stephen Chung
2021-10-21 17:26:43 +08:00
parent 313999b0ac
commit 9c16d90de9
21 changed files with 129 additions and 122 deletions

View File

@@ -67,7 +67,7 @@ impl Engine {
///
/// Not available under `unchecked`.
#[cfg(not(feature = "unchecked"))]
#[inline(always)]
#[inline]
#[must_use]
pub const fn max_operations(&self) -> u64 {
if let Some(n) = self.limits.max_operations {
@@ -117,7 +117,7 @@ impl Engine {
///
/// Not available under `unchecked`.
#[cfg(not(feature = "unchecked"))]
#[inline(always)]
#[inline]
#[must_use]
pub const fn max_expr_depth(&self) -> usize {
if let Some(n) = self.limits.max_expr_depth {
@@ -131,7 +131,7 @@ impl Engine {
/// Not available under `unchecked` or `no_function`.
#[cfg(not(feature = "unchecked"))]
#[cfg(not(feature = "no_function"))]
#[inline(always)]
#[inline]
#[must_use]
pub const fn max_function_expr_depth(&self) -> usize {
if let Some(n) = self.limits.max_function_expr_depth {
@@ -153,7 +153,7 @@ impl Engine {
///
/// Not available under `unchecked`.
#[cfg(not(feature = "unchecked"))]
#[inline(always)]
#[inline]
#[must_use]
pub const fn max_string_size(&self) -> usize {
if let Some(n) = self.limits.max_string_size {
@@ -177,7 +177,7 @@ impl Engine {
/// Not available under `unchecked` or `no_index`.
#[cfg(not(feature = "unchecked"))]
#[cfg(not(feature = "no_index"))]
#[inline(always)]
#[inline]
#[must_use]
pub const fn max_array_size(&self) -> usize {
if let Some(n) = self.limits.max_array_size {
@@ -201,7 +201,7 @@ impl Engine {
/// Not available under `unchecked` or `no_object`.
#[cfg(not(feature = "unchecked"))]
#[cfg(not(feature = "no_object"))]
#[inline(always)]
#[inline]
#[must_use]
pub const fn max_map_size(&self) -> usize {
if let Some(n) = self.limits.max_map_size {