Skip to content

Commit

Permalink
correct clippy and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ptondereau committed Oct 25, 2023
1 parent ab0bbe9 commit a98129d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
4 changes: 2 additions & 2 deletions crates/macros/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ impl<'a> Args<'a> {
syn::Pat::Ident(syn::PatIdent { ident, .. }) => ident,
_ => bail!(pat => "Unsupported argument."),
};
let nullable = type_is_nullable(&**ty)?;
let nullable = type_is_nullable(ty)?;
result.typed.push(TypedArg {
name: ident,
ty: &**ty,
ty,
nullable,
default: defaults.remove(ident),
});
Expand Down
2 changes: 1 addition & 1 deletion crates/macros/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct ImplArgs {
}

/// Different types of rename rules for methods.
#[derive(Debug, Copy, Clone, FromMeta)]
#[derive(Debug, Default, Copy, Clone, FromMeta)]
pub enum RenameRule {
/// Methods won't be renamed.
#[darling(rename = "none")]
Expand Down
17 changes: 3 additions & 14 deletions examples/hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
use ext_php_rs::{
args::Arg,
builders::{ClassBuilder, FunctionBuilder, ModuleStartup},
class::{ClassMetadata, ConstructorMeta, ConstructorResult, RegisteredClass},
constant::IntoConst,
convert::IntoZval,
flags::DataType,
internal::class::{PhpClassImpl, PhpClassImplCollector},
prelude::*,
types::{ZendClassObject, Zval},
zend::ExecuteData,
};
use ext_php_rs::{constant::IntoConst, prelude::*, types::ZendClassObject};

#[derive(Debug)]
#[php_class]
Expand Down Expand Up @@ -75,12 +64,12 @@ pub struct TestZvalConvert<'a> {
}

#[php_function]
pub fn get_zval_convert<'a>(z: TestZvalConvert<'a>) -> i32 {
pub fn get_zval_convert(z: TestZvalConvert) -> i32 {
dbg!(z);
5
}

fn startup(ty: i32, mod_num: i32) -> i32 {
fn startup(_ty: i32, mod_num: i32) -> i32 {
5.register_constant("SOME_CONST", mod_num).unwrap();
0
}
Expand Down
1 change: 0 additions & 1 deletion src/builders/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
constant::IntoConst,
error::Result,
ffi::{ext_php_rs_php_build_id, ZEND_MODULE_API_NO},
flags::MethodFlags,
zend::{FunctionEntry, ModuleEntry},
PHP_DEBUG, PHP_ZTS,
};
Expand Down
1 change: 1 addition & 0 deletions src/internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub type ModuleStartupMutex = Mutex<Option<ModuleStartup>>;

/// The initialisation value for [`ModuleStartupMutex`]. By default the mutex
/// contains [`None`].
#[allow(clippy::declare_interior_mutable_const)]
pub const MODULE_STARTUP_INIT: ModuleStartupMutex = const_mutex(None);

/// Called by startup functions registered with the [`#[php_startup]`] macro.
Expand Down
4 changes: 2 additions & 2 deletions tests/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ pub fn hello_world(name: String) -> String {
}

#[php_module]
pub fn module(module: ModuleBuilder) -> ModuleBuilder {
module
pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
module.function(wrap_function!(hello_world))
}

0 comments on commit a98129d

Please sign in to comment.