Skip to content

Commit dd8d4f7

Browse files
committed
feat(ffi): drop from raw, small typo fixes
1 parent 03a5289 commit dd8d4f7

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/action/ffi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub unsafe extern "C" fn redirectionio_action_drop(_action: *mut Action) {
5656
return;
5757
}
5858

59-
Box::from_raw(_action);
59+
drop(Box::from_raw(_action));
6060
}
6161

6262
#[no_mangle]
@@ -140,7 +140,7 @@ pub unsafe extern "C" fn redirectionio_action_body_filter_drop(_filter: *mut Fil
140140
return;
141141
}
142142

143-
Box::from_raw(_filter);
143+
drop(Box::from_raw(_filter));
144144
}
145145

146146
#[no_mangle]

src/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub unsafe extern "C" fn redirectionio_router_drop(_router: *mut Router<Rule>) {
7676
return;
7777
}
7878

79-
Box::from_raw(_router);
79+
drop(Box::from_raw(_router));
8080
}
8181

8282
#[no_mangle]

src/filter/filter_body.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl FilterBodyAction {
110110
data = if new_data.is_empty() { None } else { Some(new_data) };
111111
}
112112

113-
Ok(data.unwrap_or_else(|| Vec::new()))
113+
Ok(data.unwrap_or_default())
114114
}
115115
}
116116

src/html/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use error::Result;
66
use std::io::Read;
77
use std::string::ToString;
88

9-
#[derive(Debug, Clone, Copy, PartialEq)]
9+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1010
pub enum TokenType {
1111
NoneToken,
1212
ErrorToken,

src/http/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,5 @@ pub unsafe extern "C" fn redirectionio_request_drop(_request: *mut Request) {
214214
return;
215215
}
216216

217-
Box::from_raw(_request);
217+
drop(Box::from_raw(_request));
218218
}

src/router/transformer/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct Slice {
88
impl Transform for Slice {
99
fn transform(&self, str: String) -> String {
1010
let from = self.from;
11-
let mut to = self.to.unwrap_or_else(|| str.len());
11+
let mut to = self.to.unwrap_or(str.len());
1212

1313
if from > str.len() {
1414
return "".to_string();

0 commit comments

Comments
 (0)