inline analysis and symbol reduction; emits smaller than 64 bytes marked inline
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
1e8b8cce0f
commit
eeda96d94a
35 changed files with 117 additions and 73 deletions
|
@ -92,6 +92,7 @@ impl Error {
|
|||
}
|
||||
|
||||
/// Returns the Matrix error code / error kind
|
||||
#[inline]
|
||||
pub fn error_code(&self) -> ruma::api::client::error::ErrorKind {
|
||||
if let Self::Federation(_, error) = self {
|
||||
return error.error_kind().unwrap_or_else(|| &Unknown).clone();
|
||||
|
|
|
@ -8,5 +8,6 @@ pub struct Guard {
|
|||
}
|
||||
|
||||
impl Drop for Guard {
|
||||
#[inline]
|
||||
fn drop(&mut self) { self.capture.stop(); }
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ struct Visitor {
|
|||
}
|
||||
|
||||
impl Layer {
|
||||
#[inline]
|
||||
pub fn new(state: &Arc<State>) -> Self {
|
||||
Self {
|
||||
state: state.clone(),
|
||||
|
@ -25,6 +26,7 @@ impl Layer {
|
|||
}
|
||||
|
||||
impl fmt::Debug for Layer {
|
||||
#[inline]
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
formatter.debug_struct("capture::Layer").finish()
|
||||
}
|
||||
|
|
|
@ -3,14 +3,11 @@ mod sha256;
|
|||
|
||||
use crate::Result;
|
||||
|
||||
#[inline]
|
||||
pub fn password(password: &str) -> Result<String> { argon::password(password) }
|
||||
|
||||
#[inline]
|
||||
pub fn verify_password(password: &str, password_hash: &str) -> Result<()> {
|
||||
argon::verify_password(password, password_hash)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn calculate_hash(keys: &[&[u8]]) -> Vec<u8> { sha256::hash(keys) }
|
||||
|
|
|
@ -33,7 +33,6 @@ pub fn clamp<T: Ord>(val: T, min: T, max: T) -> T { cmp::min(cmp::max(val, min),
|
|||
///
|
||||
/// * <https://doc.rust-lang.org/std/convert/enum.Infallible.html>
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
pub fn unwrap_infallible<T>(result: Result<T, std::convert::Infallible>) -> T {
|
||||
match result {
|
||||
Ok(val) => val,
|
||||
|
|
|
@ -9,7 +9,6 @@ pub fn split_once_infallible<'a>(input: &'a str, delim: &'_ str) -> (&'a str, &'
|
|||
}
|
||||
|
||||
/// Parses the bytes into a string.
|
||||
#[inline]
|
||||
pub fn string_from_bytes(bytes: &[u8]) -> Result<String> {
|
||||
let str: &str = str_from_bytes(bytes)?;
|
||||
Ok(str.to_owned())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue