aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ports/cef/eutil.rs7
-rw-r--r--ports/cef/string_map.rs2
2 files changed, 2 insertions, 7 deletions
diff --git a/ports/cef/eutil.rs b/ports/cef/eutil.rs
index 30718f60e99..d5f9760f6bb 100644
--- a/ports/cef/eutil.rs
+++ b/ports/cef/eutil.rs
@@ -13,12 +13,7 @@ pub fn fptr_is_null(fptr: *const u8) -> bool {
pub fn slice_to_str(s: *const u8, l: uint, f: |&str| -> c_int) -> c_int {
unsafe {
slice::raw::buf_as_slice(s, l, |result| {
- match str::from_utf8(result) {
- Some(ruststr) => {
- f(ruststr)
- },
- None => 0
- }
+ str::from_utf8(result).map(|s| f(s)).unwrap_or(0)
})
}
}
diff --git a/ports/cef/string_map.rs b/ports/cef/string_map.rs
index 67469700957..67753b3c5dc 100644
--- a/ports/cef/string_map.rs
+++ b/ports/cef/string_map.rs
@@ -7,7 +7,7 @@ use libc::{c_int};
use std::collections::TreeMap;
use std::mem;
use std::string::String;
-use string::{cef_string_userfree_utf8_alloc,cef_string_userfree_utf8_free,cef_string_utf8_set};
+use string::{cef_string_userfree_utf8_alloc, cef_string_userfree_utf8_free, cef_string_utf8_set};
use types::{cef_string_map_t, cef_string_t};
fn string_map_to_treemap(sm: *mut cef_string_map_t) -> *mut TreeMap<String, *mut cef_string_t> {