Skip to content

Commit 2ee0de7

Browse files
committed
fixup! JS TextDecoder: safe and decodeBOM options
Signed-off-by: Didier Wenzek <[email protected]>
1 parent 7171072 commit 2ee0de7

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

crates/extensions/tedge_flows/src/js_lib/text_decoder.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rquickjs::JsLifetime;
77
use rquickjs::Object;
88
use rquickjs::Result;
99
use rquickjs::TypedArray;
10-
use std::borrow::Cow;
1110

1211
#[derive(Clone, Default, Trace, JsLifetime)]
1312
#[rquickjs::class(frozen)]
@@ -71,10 +70,7 @@ impl<'js> TextDecoder {
7170
.map_err(|err| Exception::throw_message(&ctx, &err.to_string()))?
7271
.to_string()
7372
} else {
74-
match String::from_utf8_lossy(bytes) {
75-
Cow::Owned(text) => text,
76-
Cow::Borrowed(text) => text.to_owned(),
77-
}
73+
String::from_utf8_lossy(bytes).to_string()
7874
};
7975

8076
Ok(text)

0 commit comments

Comments
 (0)