File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -69,8 +69,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> {
69
69
// [1]: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232
70
70
// [2]: http://www.mail-archive.com/log4net-dev@logging.apache.org/msg00661.html
71
71
const OUT_MAX : usize = 8192 ;
72
- let data_len;
73
- let utf16 = match str:: from_utf8 ( data) . ok ( ) {
72
+ let ( utf16, data_len) = match str:: from_utf8 ( data) . ok ( ) {
74
73
Some ( mut utf8) => {
75
74
if utf8. len ( ) > OUT_MAX {
76
75
let mut new_len = OUT_MAX ;
@@ -79,8 +78,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> {
79
78
}
80
79
utf8 = & utf8[ ..new_len] ;
81
80
}
82
- data_len = utf8. len ( ) ;
83
- utf8. encode_utf16 ( ) . collect :: < Vec < u16 > > ( )
81
+ ( utf8. encode_utf16 ( ) . collect :: < Vec < u16 > > ( ) , utf8. len ( ) )
84
82
}
85
83
None => return Err ( invalid_encoding ( ) ) ,
86
84
} ;
You can’t perform that action at this time.
0 commit comments