Skip to content

Commit 89900c0

Browse files
committed
examples/rust: Remove some redundant unsafe blocks
... as noted by the compiler... Fixes: 2cf492f ("examples/rust: Fix some new rustc warnings") Signed-off-by: Andrew Clayton <[email protected]>
1 parent a7ca008 commit 89900c0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/rust/echo-request/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
5151
uwr_init_ctx(ctx, addr, 4096);
5252

5353
// Set where we will copy the request into
54-
uwr_set_req_buf(ctx, unsafe { addr_of_mut!(REQUEST_BUF) }, LUW_SRB_NONE);
54+
uwr_set_req_buf(ctx, addr_of_mut!(REQUEST_BUF), LUW_SRB_NONE);
5555

5656
// Define the Response Body Text.
5757

examples/rust/large-upload/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub unsafe extern "C" fn uwr_response_end_handler() {
3232

3333
#[no_mangle]
3434
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
35-
let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
35+
let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
3636
let mut f;
3737
let bytes_wrote: isize;
3838
let mut total = unsafe { TOTAL_BYTES_WROTE };
@@ -41,7 +41,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
4141
uwr_init_ctx(ctx, addr, 0);
4242
uwr_set_req_buf(
4343
ctx,
44-
unsafe { addr_of_mut!(REQUEST_BUF) },
44+
addr_of_mut!(REQUEST_BUF),
4545
LUW_SRB_NONE,
4646
);
4747

examples/rust/upload-reflector/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn upload_reflector(ctx: *mut luw_ctx_t) -> i32 {
7272

7373
#[no_mangle]
7474
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
75-
let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
75+
let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
7676

7777
if unsafe { REQUEST_BUF.is_null() } {
7878
uwr_init_ctx(ctx, addr, 0 /* Response offset */);
@@ -87,7 +87,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
8787
*/
8888
uwr_set_req_buf(
8989
ctx,
90-
unsafe { addr_of_mut!(REQUEST_BUF) },
90+
addr_of_mut!(REQUEST_BUF),
9191
LUW_SRB_APPEND | LUW_SRB_ALLOC | LUW_SRB_FULL_SIZE,
9292
);
9393
} else {

0 commit comments

Comments
 (0)