summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorYiyu Lin <linyiyu1992@gmail.com>2020-05-16 21:41:32 +0800
committerGitHub <noreply@github.com>2020-05-16 09:41:32 -0400
commit0b9942da84bb9bfc9fc1eaf4170ad71864b7c179 (patch)
tree050a3760d4d0c4c9b3cd276a40808bbbe520f000 /core
parent59cb3c14c729cafa81022b4374de58d006bfe677 (diff)
fix some unwrap() in Rust (#5485)
Diffstat (limited to 'core')
-rw-r--r--core/isolate.rs3
-rw-r--r--core/js_errors.rs3
2 files changed, 2 insertions, 4 deletions
diff --git a/core/isolate.rs b/core/isolate.rs
index e9ff9474c..d017687c6 100644
--- a/core/isolate.rs
+++ b/core/isolate.rs
@@ -529,8 +529,7 @@ impl Future for CoreIsolate {
assert_eq!(inner.shared.size(), 0);
}
- if overflow_response.is_some() {
- let (op_id, buf) = overflow_response.take().unwrap();
+ if let Some((op_id, buf)) = overflow_response.take() {
async_op_response(
scope,
Some((op_id, buf)),
diff --git a/core/js_errors.rs b/core/js_errors.rs
index dfad7238e..e8ea5a342 100644
--- a/core/js_errors.rs
+++ b/core/js_errors.rs
@@ -261,8 +261,7 @@ fn format_source_loc(
impl fmt::Display for JSError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- if self.script_resource_name.is_some() {
- let script_resource_name = self.script_resource_name.as_ref().unwrap();
+ if let Some(script_resource_name) = &self.script_resource_name {
if self.line_number.is_some() && self.start_column.is_some() {
assert!(self.line_number.is_some());
assert!(self.start_column.is_some());