Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit 87a97eb

Browse files
committed
API-Rust.md: Remove some redundant unsafe blocks from example code
Mirrors changes in 89900c0 ("examples/rust: Remove some redundant unsafe blocks") Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
1 parent 7ef2f18 commit 87a97eb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

API-Rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static mut REQUEST_BUF: *mut u8 = null_mut();
492492
*/ ... */
493493
#[no_mangle]
494494
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
495-
let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
495+
let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
496496

497497
if unsafe { REQUEST_BUF.is_null() } {
498498
uwr_init_ctx(ctx, addr, 0 /* Response offset */);
@@ -507,7 +507,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
507507
*/
508508
uwr_set_req_buf(
509509
ctx,
510-
unsafe { addr_of_mut!(REQUEST_BUF) },
510+
addr_of_mut!(REQUEST_BUF),
511511
LUW_SRB_APPEND | LUW_SRB_ALLOC | LUW_SRB_FULL_SIZE,
512512
);
513513
} else {
@@ -811,7 +811,7 @@ Example
811811
```Rust
812812
#[no_mangle]
813813
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
814-
let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
814+
let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
815815
816816
if unsafe { REQUEST_BUF.is_null() } {
817817
uwr_init_ctx(ctx, addr, 0 /* Response offset */);
@@ -826,7 +826,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
826826
*/
827827
uwr_set_req_buf(
828828
ctx,
829-
unsafe { addr_of_mut!(REQUEST_BUF) },
829+
addr_of_mut!(REQUEST_BUF),
830830
LUW_SRB_APPEND | LUW_SRB_ALLOC | LUW_SRB_FULL_SIZE,
831831
);
832832
} else {
@@ -868,7 +868,7 @@ Example
868868
869869
```Rust
870870
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
871-
let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
871+
let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
872872
let mut f;
873873
let bytes_wrote: isize;
874874
let mut total = unsafe { TOTAL_BYTES_WROTE };
@@ -877,7 +877,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
877877
uwr_init_ctx(ctx, addr, 0);
878878
uwr_set_req_buf(
879879
ctx,
880-
unsafe { addr_of_mut!(REQUEST_BUF) },
880+
addr_of_mut!(REQUEST_BUF),
881881
LUW_SRB_NONE
882882
);
883883

0 commit comments

Comments
 (0)