From 8d6850afd07342fd9921f3ffab1e3dd8d3e3a54f Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Tue, 20 Dec 2022 16:04:41 +0000 Subject: [PATCH] Format --- src/exception.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/exception.rs b/src/exception.rs index f167c8d..e1f4c63 100644 --- a/src/exception.rs +++ b/src/exception.rs @@ -8,7 +8,8 @@ use crate::{ ffi::zend_throw_exception_ex, ffi::zend_throw_exception_object, flags::ClassFlags, - zend::{ce, ClassEntry}, types::Zval, + types::Zval, + zend::{ce, ClassEntry}, }; /// Result type with the error variant as a [`PhpException`]. @@ -38,7 +39,12 @@ impl PhpException { /// * `code` - Integer code to go inside the exception. /// * `ex` - Exception type to throw. pub fn new(message: String, code: i32, ex: &'static ClassEntry) -> Self { - Self { message, code, ex, object: None, } + Self { + message, + code, + ex, + object: None, + } } /// Creates a new default exception instance, using the default PHP @@ -77,9 +83,7 @@ impl PhpException { /// and an error otherwise. pub fn throw(self) -> Result<()> { match self.object { - Some(object) => { - throw_object(object) - }, + Some(object) => throw_object(object), None => throw_with_code(self.ex, self.code, &self.message), } } @@ -166,7 +170,6 @@ pub fn throw_with_code(ex: &ClassEntry, code: i32, message: &str) -> Result<()> Ok(()) } - /// Throws an exception object. /// /// Returns a result containing nothing if the exception was successfully