Skip to content

Commit 7ce22d1

Browse files
committed
chore: reformat for edition 2024
1 parent 1eae627 commit 7ce22d1

21 files changed

Lines changed: 45 additions & 56 deletions

File tree

examples/async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use std::time::Instant;
66

77
use ngx::core;
88
use ngx::ffi::{
9+
NGX_CONF_TAKE1, NGX_HTTP_LOC_CONF, NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_MODULE, NGX_LOG_EMERG,
910
ngx_array_push, ngx_command_t, ngx_conf_t, ngx_connection_t, ngx_event_t, ngx_http_handler_pt,
1011
ngx_http_module_t, ngx_http_phases_NGX_HTTP_ACCESS_PHASE, ngx_int_t, ngx_module_t,
1112
ngx_post_event, ngx_posted_events, ngx_posted_next_events, ngx_str_t, ngx_uint_t,
12-
NGX_CONF_TAKE1, NGX_HTTP_LOC_CONF, NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_MODULE, NGX_LOG_EMERG,
1313
};
1414
use ngx::http::{self, HttpModule, MergeConfigError};
1515
use ngx::http::{HttpModuleLocationConf, HttpModuleMainConf, NgxHttpCoreModule};

examples/awssig.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use std::ffi::{c_char, c_void};
33
use http::HeaderMap;
44
use ngx::core;
55
use ngx::ffi::{
6-
ngx_array_push, ngx_command_t, ngx_conf_t, ngx_http_handler_pt, ngx_http_module_t,
7-
ngx_http_phases_NGX_HTTP_PRECONTENT_PHASE, ngx_int_t, ngx_module_t, ngx_str_t, ngx_uint_t,
86
NGX_CONF_TAKE1, NGX_HTTP_LOC_CONF, NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_MODULE,
9-
NGX_HTTP_SRV_CONF, NGX_LOG_EMERG,
7+
NGX_HTTP_SRV_CONF, NGX_LOG_EMERG, ngx_array_push, ngx_command_t, ngx_conf_t,
8+
ngx_http_handler_pt, ngx_http_module_t, ngx_http_phases_NGX_HTTP_PRECONTENT_PHASE, ngx_int_t,
9+
ngx_module_t, ngx_str_t, ngx_uint_t,
1010
};
1111
use ngx::http::*;
1212
use ngx::{http_request_handler, ngx_conf_log_error, ngx_log_debug_http, ngx_string};
@@ -267,11 +267,7 @@ http_request_handler!(awssigv4_header_handler, |request: &mut Request| {
267267
// get Module Config from request
268268
let conf = Module::location_conf(request).expect("module conf");
269269
ngx_log_debug_http!(request, "AWS signature V4 module {}", {
270-
if conf.enable {
271-
"enabled"
272-
} else {
273-
"disabled"
274-
}
270+
if conf.enable { "enabled" } else { "disabled" }
275271
});
276272
if !conf.enable {
277273
return core::Status::NGX_DECLINED;

examples/curl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use std::ffi::{c_char, c_void};
22

33
use ngx::core;
44
use ngx::ffi::{
5+
NGX_CONF_TAKE1, NGX_HTTP_LOC_CONF, NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_MODULE, NGX_LOG_EMERG,
56
ngx_array_push, ngx_command_t, ngx_conf_t, ngx_http_handler_pt, ngx_http_module_t,
67
ngx_http_phases_NGX_HTTP_ACCESS_PHASE, ngx_int_t, ngx_module_t, ngx_str_t, ngx_uint_t,
7-
NGX_CONF_TAKE1, NGX_HTTP_LOC_CONF, NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_MODULE, NGX_LOG_EMERG,
88
};
99
use ngx::http::{self, HttpModule, MergeConfigError};
1010
use ngx::http::{HttpModuleLocationConf, HttpModuleMainConf, NgxHttpCoreModule};

examples/httporigdst.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::ffi::{c_int, c_void};
2-
use std::ptr::{addr_of, NonNull};
2+
use std::ptr::{NonNull, addr_of};
33

44
use ngx::core;
55
use ngx::ffi::{
6-
in_port_t, ngx_conf_t, ngx_connection_local_sockaddr, ngx_http_add_variable, ngx_http_module_t,
7-
ngx_http_variable_t, ngx_inet_get_port, ngx_int_t, ngx_module_t, ngx_sock_ntop, ngx_str_t,
8-
ngx_variable_value_t, sockaddr, sockaddr_storage, INET_ADDRSTRLEN, NGX_HTTP_MODULE,
6+
INET_ADDRSTRLEN, NGX_HTTP_MODULE, in_port_t, ngx_conf_t, ngx_connection_local_sockaddr,
7+
ngx_http_add_variable, ngx_http_module_t, ngx_http_variable_t, ngx_inet_get_port, ngx_int_t,
8+
ngx_module_t, ngx_sock_ntop, ngx_str_t, ngx_variable_value_t, sockaddr, sockaddr_storage,
99
};
1010
use ngx::http::{self, HttpModule};
1111
use ngx::{http_variable_get, ngx_log_debug_http, ngx_string};

examples/shared_dict.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#![no_std]
22
use ::core::ffi::{c_char, c_void};
33
use ::core::{mem, ptr};
4-
54
use nginx_sys::{
5+
NGX_CONF_TAKE2, NGX_HTTP_DELETE, NGX_HTTP_MAIN_CONF, NGX_HTTP_MAIN_CONF_OFFSET,
6+
NGX_HTTP_MODULE, NGX_HTTP_VAR_CHANGEABLE, NGX_HTTP_VAR_NOCACHEABLE, NGX_LOG_EMERG,
67
ngx_command_t, ngx_conf_t, ngx_http_add_variable, ngx_http_compile_complex_value_t,
78
ngx_http_complex_value, ngx_http_complex_value_t, ngx_http_module_t, ngx_http_request_t,
89
ngx_http_variable_t, ngx_http_variable_value_t, ngx_int_t, ngx_module_t, ngx_parse_size,
9-
ngx_shared_memory_add, ngx_shm_zone_t, ngx_str_t, ngx_uint_t, NGX_CONF_TAKE2, NGX_HTTP_DELETE,
10-
NGX_HTTP_MAIN_CONF, NGX_HTTP_MAIN_CONF_OFFSET, NGX_HTTP_MODULE, NGX_HTTP_VAR_CHANGEABLE,
11-
NGX_HTTP_VAR_NOCACHEABLE, NGX_LOG_EMERG,
10+
ngx_shared_memory_add, ngx_shm_zone_t, ngx_str_t, ngx_uint_t,
1211
};
1312
use ngx::collections::RbTreeMap;
14-
use ngx::core::{NgxStr, NgxString, Pool, SlabPool, Status, NGX_CONF_ERROR, NGX_CONF_OK};
13+
use ngx::core::{NGX_CONF_ERROR, NGX_CONF_OK, NgxStr, NgxString, Pool, SlabPool, Status};
1514
use ngx::http::{HttpModule, HttpModuleMainConf};
1615
use ngx::{ngx_conf_log_error, ngx_log_debug, ngx_string};
1716

examples/upstream.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ use std::mem;
1111

1212
use ngx::core::{Pool, Status};
1313
use ngx::ffi::{
14-
ngx_atoi, ngx_command_t, ngx_conf_t, ngx_connection_t, ngx_event_free_peer_pt,
15-
ngx_event_get_peer_pt, ngx_http_module_t, ngx_http_upstream_init_peer_pt,
16-
ngx_http_upstream_init_pt, ngx_http_upstream_init_round_robin, ngx_http_upstream_srv_conf_t,
17-
ngx_http_upstream_t, ngx_int_t, ngx_module_t, ngx_peer_connection_t, ngx_str_t, ngx_uint_t,
1814
NGX_CONF_NOARGS, NGX_CONF_TAKE1, NGX_CONF_UNSET, NGX_ERROR, NGX_HTTP_MODULE,
19-
NGX_HTTP_SRV_CONF_OFFSET, NGX_HTTP_UPS_CONF, NGX_LOG_EMERG,
15+
NGX_HTTP_SRV_CONF_OFFSET, NGX_HTTP_UPS_CONF, NGX_LOG_EMERG, ngx_atoi, ngx_command_t,
16+
ngx_conf_t, ngx_connection_t, ngx_event_free_peer_pt, ngx_event_get_peer_pt, ngx_http_module_t,
17+
ngx_http_upstream_init_peer_pt, ngx_http_upstream_init_pt, ngx_http_upstream_init_round_robin,
18+
ngx_http_upstream_srv_conf_t, ngx_http_upstream_t, ngx_int_t, ngx_module_t,
19+
ngx_peer_connection_t, ngx_str_t, ngx_uint_t,
2020
};
2121
use ngx::http::{HttpModule, Merge, MergeConfigError, Request};
2222
use ngx::http::{HttpModuleServerConf, NgxHttpUpstreamModule};

nginx-src/src/download.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ static CACHE_DIR: LazyLock<PathBuf> = LazyLock::new(|| {
120120
let base_dir = env::var("OUT_DIR")
121121
.map(PathBuf::from)
122122
.unwrap_or_else(|_| env::current_dir().expect("Failed to get current directory"));
123-
// Choose `.cache` relative to the OUT_DIR of the caller (nginx-sys) as the default cache directory
124-
// Environment variable `CACHE_DIR` overrides this
123+
// Choose `.cache` relative to the OUT_DIR of the caller (nginx-sys) as the default cache
124+
// directory Environment variable `CACHE_DIR` overrides this
125125
// Recommendation: set env "CACHE_DIR = { value = ".cache", relative = true }" in
126126
// `.cargo/config.toml` in your project
127127
let cache_dir = env::var("CACHE_DIR")

nginx-sys/build/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extern crate bindgen;
22

33
use std::env;
44
use std::error::Error as StdError;
5-
use std::fs::{read_to_string, File};
5+
use std::fs::{File, read_to_string};
66
use std::io::Write;
77
use std::path::{Path, PathBuf};
88

nginx-sys/src/event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use core::ptr;
22

33
use crate::{
4-
ngx_current_msec, ngx_event_t, ngx_event_timer_rbtree, ngx_msec_t, ngx_queue_insert_before,
5-
ngx_queue_remove, ngx_queue_t, ngx_rbtree_delete, ngx_rbtree_insert, NGX_TIMER_LAZY_DELAY,
4+
NGX_TIMER_LAZY_DELAY, ngx_current_msec, ngx_event_t, ngx_event_timer_rbtree, ngx_msec_t,
5+
ngx_queue_insert_before, ngx_queue_remove, ngx_queue_t, ngx_rbtree_delete, ngx_rbtree_insert,
66
};
77

88
/// Sets a timeout for an event.

nginx-sys/src/rbtree.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ macro_rules! ngx_rbtree_data {
2323
///
2424
/// All of the pointers passed must be valid.
2525
/// `sentinel` is expected to be valid for the whole lifetime of the `tree`.
26-
///
2726
pub unsafe fn ngx_rbtree_init(
2827
tree: *mut ngx_rbtree_t,
2928
sentinel: *mut ngx_rbtree_node_t,

0 commit comments

Comments
 (0)