Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed to using unwrap() #70

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/async/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct User {
impl User {
async fn fetch(user: &str) -> Result<Self, JsValue> {
let user = fetch_github(&format!("https://api.github.com/users/{}", user)).await?;
Ok(serde_json::from_str::<Self>(&user).unwrap_throw())
Ok(serde_json::from_str::<Self>(&user).unwrap())
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/async/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub async fn fetch_github(url: &str) -> Result<String, JsValue> {
headers.set("Accept", "application/vnd.github.v3+json")?;

let future = window()
.unwrap_throw()
.unwrap()
.fetch_with_str_and_init(
url,
RequestInit::new()
Expand All @@ -131,7 +131,7 @@ pub async fn fetch_github(url: &str) -> Result<String, JsValue> {
let value = JsFuture::from(response.text()?)
.await?
.as_string()
.unwrap_throw();
.unwrap();

Ok(value)
}
8 changes: 4 additions & 4 deletions examples/todomvc/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum Route {
impl Route {
// This could use more advanced URL parsing, but it isn't needed
pub fn from_url(url: &str) -> Self {
let url = Url::new(&url).unwrap_throw();
let url = Url::new(&url).unwrap();
match url.hash().as_str() {
"#/active" => Route::Active,
"#/completed" => Route::Completed,
Expand Down Expand Up @@ -72,19 +72,19 @@ impl App {
pub fn deserialize() -> Arc<Self> {
local_storage()
.get_item("todos-rust-dominator")
.unwrap_throw()
.unwrap()
.and_then(|state_json| {
serde_json::from_str(state_json.as_str()).ok()
})
.unwrap_or_else(App::new)
}

pub fn serialize(&self) {
let state_json = serde_json::to_string(self).unwrap_throw();
let state_json = serde_json::to_string(self).unwrap();

local_storage()
.set_item("todos-rust-dominator", state_json.as_str())
.unwrap_throw();
.unwrap();
}

pub fn route(&self) -> impl Signal<Item = Route> {
Expand Down
2 changes: 1 addition & 1 deletion examples/todomvc/src/todo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Todo {
.event(clone!(todo => move |event: events::KeyDown| {
match event.key().as_str() {
"Enter" => {
element.blur().unwrap_throw();
element.blur().unwrap();
},
"Escape" => {
todo.cancel_editing();
Expand Down
2 changes: 1 addition & 1 deletion examples/todomvc/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use web_sys::{window, Storage};


pub fn local_storage() -> Storage {
window().unwrap_throw().local_storage().unwrap_throw().unwrap_throw()
window().unwrap().local_storage().unwrap().unwrap()
}

#[inline]
Expand Down
Loading