Skip to content

Commit 4823e35

Browse files
committed
Format with merge_imports.
1 parent 29225fb commit 4823e35

File tree

8 files changed

+75
-62
lines changed

8 files changed

+75
-62
lines changed

examples/simple/src/lib.rs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
use phper::sys::OnUpdateBool;
2-
use phper::sys::{php_info_print_table_end, php_info_print_table_row, php_info_print_table_start};
3-
use phper::sys::{zend_function_entry, zend_internal_arg_info, PHP_INI_SYSTEM};
4-
use phper::sys::{zend_read_property, zend_type, OnUpdateString, ZEND_ACC_PUBLIC};
5-
use phper::zend::api::{function_entry_end, FunctionEntries, ModuleGlobals};
6-
use phper::zend::compile::{internal_arg_info_begin, MultiInternalArgInfo};
7-
use phper::zend::ini::{ini_entry_def_end, IniEntryDefs};
8-
use phper::zend::modules::{create_zend_module_entry, ModuleArgs, ModuleEntry};
9-
use phper::zend::types::{ClassEntry, ExecuteData, SetVal, Val};
10-
use phper::{c_str_ptr, php_fn};
111
use phper::{
12-
php_function, php_minit, php_minit_function, php_mshutdown, php_mshutdown_function,
13-
php_rinit_function, php_rshutdown_function,
2+
c_str_ptr, php_fn, php_function, php_minfo, php_minfo_function, php_minit, php_minit_function,
3+
php_mshutdown, php_mshutdown_function, php_rinit, php_rinit_function, php_rshutdown,
4+
php_rshutdown_function,
5+
sys::{
6+
php_info_print_table_end, php_info_print_table_row, php_info_print_table_start,
7+
zend_function_entry, zend_internal_arg_info, zend_read_property, zend_type, OnUpdateBool,
8+
OnUpdateString, PHP_INI_SYSTEM, ZEND_ACC_PUBLIC,
9+
},
10+
zend::{
11+
api::{function_entry_end, FunctionEntries, ModuleGlobals},
12+
compile::{internal_arg_info_begin, MultiInternalArgInfo},
13+
ini::{ini_entry_def_end, IniEntryDefs},
14+
modules::{create_zend_module_entry, ModuleArgs, ModuleEntry},
15+
types::{ClassEntry, ExecuteData, SetVal, Val},
16+
},
17+
zend_get_module,
18+
};
19+
use std::{
20+
mem::{size_of, transmute},
21+
os::raw::c_char,
22+
ptr::{null, null_mut},
1423
};
15-
use phper::{php_minfo, php_minfo_function, php_rinit, php_rshutdown, zend_get_module};
16-
use std::mem::{size_of, transmute};
17-
use std::os::raw::c_char;
18-
use std::ptr::{null, null_mut};
1924

2025
static MY_CLASS_CE: ClassEntry = ClassEntry::new();
2126

phper-alloc/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![feature(allocator_api)]
22

33
use phper_sys::{_efree, _emalloc};
4-
use std::alloc::{AllocError, AllocRef, Layout};
5-
use std::os::raw::c_char;
6-
use std::ptr::{slice_from_raw_parts_mut, NonNull};
4+
use std::{
5+
alloc::{AllocError, AllocRef, Layout},
6+
os::raw::c_char,
7+
ptr::{slice_from_raw_parts_mut, NonNull},
8+
};
79

810
pub type EBox<T> = Box<T, Allocator>;
911

phper-sys/build.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
use bindgen::Builder;
2-
use std::env;
3-
use std::ffi::OsStr;
4-
use std::fmt::Debug;
5-
use std::path::PathBuf;
6-
use std::process::Command;
2+
use std::{env, ffi::OsStr, fmt::Debug, path::PathBuf, process::Command};
73

84
fn main() {
95
println!("cargo:rerun-if-changed=php_wrapper.h");

phper/src/zend/api.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
use crate::sys::{zend_function_entry, zend_ini_entry_def};
2-
use crate::zend::ini::Mh;
3-
use std::cell::Cell;
4-
use std::mem::{size_of, transmute};
5-
use std::os::raw::c_int;
6-
use std::ptr::null_mut;
1+
use crate::{
2+
sys::{zend_function_entry, zend_ini_entry_def},
3+
zend::ini::Mh,
4+
};
5+
use std::{
6+
cell::Cell,
7+
mem::{size_of, transmute},
8+
os::raw::c_int,
9+
ptr::null_mut,
10+
};
711

812
pub const fn function_entry_end() -> zend_function_entry {
913
unsafe { transmute([0u8; size_of::<zend_function_entry>()]) }

phper/src/zend/ini.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use crate::sys::zend_ini_entry_def;
2-
use crate::sys::{zend_ini_entry, zend_string};
3-
use std::cell::Cell;
4-
use std::mem::{size_of, transmute};
5-
use std::os::raw::{c_int, c_void};
1+
use crate::sys::{zend_ini_entry, zend_ini_entry_def, zend_string};
2+
use std::{
3+
cell::Cell,
4+
mem::{size_of, transmute},
5+
os::raw::{c_int, c_void},
6+
};
67

78
pub type Mh = unsafe extern "C" fn(
89
*mut zend_ini_entry,

phper/src/zend/modules.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
use crate::sys::zend_function_entry;
2-
use crate::sys::zend_module_entry;
3-
use crate::sys::zend_register_ini_entries;
4-
use crate::sys::zend_unregister_ini_entries;
5-
use crate::sys::PHP_MODULE_BUILD_ID;
6-
use crate::sys::USING_ZTS;
7-
use crate::sys::ZEND_DEBUG;
8-
use crate::sys::ZEND_MODULE_API_NO;
9-
use crate::zend::ini::IniEntryDefs;
10-
use std::cell::Cell;
11-
use std::mem::size_of;
12-
use std::os::raw::{c_char, c_int, c_uchar, c_uint, c_ushort, c_void};
13-
use std::ptr::{null, null_mut};
1+
use crate::{
2+
sys::{
3+
zend_function_entry, zend_module_entry, zend_register_ini_entries,
4+
zend_unregister_ini_entries, PHP_MODULE_BUILD_ID, USING_ZTS, ZEND_DEBUG,
5+
ZEND_MODULE_API_NO,
6+
},
7+
zend::ini::IniEntryDefs,
8+
};
9+
use std::{
10+
cell::Cell,
11+
mem::size_of,
12+
os::raw::{c_char, c_int, c_uchar, c_uint, c_ushort, c_void},
13+
ptr::{null, null_mut},
14+
};
1415

1516
pub const fn create_zend_module_entry(
1617
name: *const c_char,

phper/src/zend/types.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
use crate::c_str_ptr;
2-
use crate::sys::{
3-
phper_init_class_entry, phper_zval_get_type, phper_zval_stringl, zend_class_entry,
4-
zend_declare_property, zend_execute_data, zend_parse_parameters, zend_register_internal_class,
5-
zend_throw_exception, zend_type, zval, IS_FALSE, IS_LONG, IS_NULL, IS_STRING, IS_TRUE,
6-
ZEND_RESULT_CODE_SUCCESS,
1+
use crate::{
2+
c_str_ptr,
3+
sys::{
4+
phper_init_class_entry, phper_zval_get_type, phper_zval_stringl, zend_class_entry,
5+
zend_declare_property, zend_execute_data, zend_parse_parameters,
6+
zend_register_internal_class, zend_throw_exception, zend_type, zval, IS_FALSE, IS_LONG,
7+
IS_NULL, IS_STRING, IS_TRUE, ZEND_RESULT_CODE_SUCCESS,
8+
},
9+
zend::{api::FunctionEntries, exceptions::Throwable},
10+
};
11+
use std::{
12+
borrow::Cow,
13+
cell::Cell,
14+
ffi::{c_void, CStr},
15+
mem::MaybeUninit,
16+
os::raw::{c_char, c_int},
17+
ptr::null_mut,
718
};
8-
use crate::zend::api::FunctionEntries;
9-
use crate::zend::exceptions::Throwable;
10-
use std::borrow::Cow;
11-
use std::cell::Cell;
12-
use std::ffi::{c_void, CStr};
13-
use std::mem::MaybeUninit;
14-
use std::os::raw::{c_char, c_int};
15-
use std::ptr::null_mut;
1619

1720
pub struct ClassEntry {
1821
inner: Cell<*mut zend_class_entry>,

rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
merge_imports = true

0 commit comments

Comments
 (0)