From fd85f840cd707c31d08fa836562127e249c9ff62 Mon Sep 17 00:00:00 2001 From: Yiyu Lin Date: Sun, 15 Jan 2023 12:06:46 +0800 Subject: refactor: clean up `unwrap` and `clone` (#17282) Co-authored-by: Divy Srivastava --- ext/broadcast_channel/lib.rs | 7 ++++--- ext/cache/lib.rs | 15 +++++++-------- ext/cache/sqlite.rs | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'ext') diff --git a/ext/broadcast_channel/lib.rs b/ext/broadcast_channel/lib.rs index 0bf359e6b..de9bef881 100644 --- a/ext/broadcast_channel/lib.rs +++ b/ext/broadcast_channel/lib.rs @@ -5,6 +5,10 @@ mod in_memory_broadcast_channel; pub use in_memory_broadcast_channel::InMemoryBroadcastChannel; pub use in_memory_broadcast_channel::InMemoryBroadcastChannelResource; +use std::cell::RefCell; +use std::path::PathBuf; +use std::rc::Rc; + use async_trait::async_trait; use deno_core::error::AnyError; use deno_core::include_js_files; @@ -14,9 +18,6 @@ use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; use deno_core::ZeroCopyBuf; -use std::cell::RefCell; -use std::path::PathBuf; -use std::rc::Rc; #[async_trait] pub trait BroadcastChannel: Clone { diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs index c48b7cda4..8aab33268 100644 --- a/ext/cache/lib.rs +++ b/ext/cache/lib.rs @@ -1,8 +1,9 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -mod sqlite; -use deno_core::ByteString; -pub use sqlite::SqliteBackedCache; +use std::cell::RefCell; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; use async_trait::async_trait; use deno_core::error::AnyError; @@ -10,15 +11,13 @@ use deno_core::include_js_files; use deno_core::op; use deno_core::serde::Deserialize; use deno_core::serde::Serialize; +use deno_core::ByteString; use deno_core::Extension; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; - -use std::cell::RefCell; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; +mod sqlite; +pub use sqlite::SqliteBackedCache; #[derive(Clone)] pub struct CreateCache(pub Arc C>); diff --git a/ext/cache/sqlite.rs b/ext/cache/sqlite.rs index 2d8e83f4b..0252934e5 100644 --- a/ext/cache/sqlite.rs +++ b/ext/cache/sqlite.rs @@ -1,5 +1,12 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +use std::borrow::Cow; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; +use std::time::SystemTime; +use std::time::UNIX_EPOCH; + use async_trait::async_trait; use deno_core::error::AnyError; use deno_core::parking_lot::Mutex; @@ -13,13 +20,6 @@ use rusqlite::OptionalExtension; use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; -use std::borrow::Cow; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::Arc; -use std::time::SystemTime; -use std::time::UNIX_EPOCH; - use crate::deserialize_headers; use crate::get_header; use crate::serialize_headers; -- cgit v1.2.3