Skip to content

Commit e482ef9

Browse files
committed
feat: set workspace edition = "2024" rust-version = "1.85.0"
rust 1.85 is the MSRV for edition 2024. cargo fmt --all reformats many files for 2024. Manual fix to ngx_container_of! macro for safety rules in 2024 - wasn't possible to fix automatically with cargo fix.
1 parent ebe9172 commit e482ef9

File tree

17 files changed

+35
-40
lines changed

17 files changed

+35
-40
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ members = [
66
]
77

88
[workspace.package]
9-
edition = "2021"
9+
edition = "2024"
1010
license = "Apache-2.0"
1111
homepage = "https://github.com/nginx/ngx-rust"
1212
repository = "https://github.com/nginx/ngx-rust"
13-
rust-version = "1.81.0"
13+
rust-version = "1.85.0"
1414

1515
[package]
1616
name = "ngx"

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::ptr::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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ use ::core::ffi::{c_char, c_void};
33
use ::core::{mem, ptr};
44

55
use nginx_sys::{
6+
NGX_CONF_TAKE2, NGX_HTTP_DELETE, NGX_HTTP_MAIN_CONF, NGX_HTTP_MAIN_CONF_OFFSET,
7+
NGX_HTTP_MODULE, NGX_HTTP_VAR_CHANGEABLE, NGX_HTTP_VAR_NOCACHEABLE, NGX_LOG_EMERG,
68
ngx_command_t, ngx_conf_t, ngx_http_add_variable, ngx_http_compile_complex_value_t,
79
ngx_http_complex_value, ngx_http_complex_value_t, ngx_http_module_t, ngx_http_request_t,
810
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,
11+
ngx_shared_memory_add, ngx_shm_zone_t, ngx_str_t, ngx_uint_t,
1212
};
1313
use ngx::collections::RbTreeMap;
14-
use ngx::core::{NgxStr, NgxString, Pool, SlabPool, Status, NGX_CONF_ERROR, NGX_CONF_OK};
14+
use ngx::core::{NGX_CONF_ERROR, NGX_CONF_OK, NgxStr, NgxString, Pool, SlabPool, Status};
1515
use ngx::http::{HttpModule, HttpModuleMainConf};
1616
use ngx::{ngx_conf_log_error, ngx_log_debug, ngx_string};
1717

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-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.

src/async_/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Async runtime and set of utilities on top of the NGINX event loop.
2-
pub use self::sleep::{sleep, Sleep};
3-
pub use self::spawn::{spawn, Task};
2+
pub use self::sleep::{Sleep, sleep};
3+
pub use self::spawn::{Task, spawn};
44

55
mod sleep;
66
mod spawn;

0 commit comments

Comments
 (0)