Skip to content

Commit 7ef0c6b

Browse files
committed
fix: rustfmt + clippy
1 parent 68cb701 commit 7ef0c6b

File tree

8 files changed

+34
-33
lines changed

8 files changed

+34
-33
lines changed

src/components/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use leptos::{component, provide_context, view, IntoView, RwSignal};
22

33
use super::program_window::{select_example, Program, ProgramWindow, Runtime};
4-
use crate::components::navigation::Navigation;
54
use crate::components::footer::Footer;
5+
use crate::components::navigation::Navigation;
66
use crate::components::run_window::{HashCount, KeyCount, RunWindow, SignedData, TxEnv};
77
use crate::components::state::LocalStorage;
88
use crate::examples;
@@ -39,4 +39,4 @@ pub fn App() -> impl IntoView {
3939
</section>
4040
<Footer />
4141
}
42-
}
42+
}

src/components/footer.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn Footer() -> impl IntoView {
2121
</p>
2222
<NewsletterForm />
2323
</div>
24-
24+
2525
<div class="footer-bottom">
2626
<div class="footer-links">
2727
<a href="https://blockstream.com/terms/" class="footer-link">
@@ -57,7 +57,7 @@ fn NewsletterForm() -> impl IntoView {
5757

5858
let handle_submit = move |ev: leptos::ev::SubmitEvent| {
5959
ev.prevent_default();
60-
60+
6161
let email_value = email.get();
6262
if email_value.is_empty() || !email_value.contains('@') {
6363
set_status.set(FormStatus::Error);
@@ -66,12 +66,13 @@ fn NewsletterForm() -> impl IntoView {
6666
}
6767

6868
set_status.set(FormStatus::Loading);
69-
69+
7070
spawn_local(async move {
7171
match subscribe_to_newsletter(email_value).await {
7272
Ok(_) => {
7373
set_status.set(FormStatus::Success);
74-
set_message.set("Thank you for subscribing! We'll keep you updated.".to_string());
74+
set_message
75+
.set("Thank you for subscribing! We'll keep you updated.".to_string());
7576
set_email.set(String::new());
7677
}
7778
Err(err) => {
@@ -96,8 +97,8 @@ fn NewsletterForm() -> impl IntoView {
9697
required
9798
/>
9899
</div>
99-
<button
100-
type="submit"
100+
<button
101+
type="submit"
101102
class="newsletter-button"
102103
disabled=move || matches!(status.get(), FormStatus::Loading)
103104
>
@@ -131,16 +132,16 @@ enum FormStatus {
131132
async fn subscribe_to_newsletter(email: String) -> Result<(), String> {
132133
use gloo_net::http::Request;
133134
use serde_json::json;
134-
135+
135136
let api_url = "https://simplicity-lang.org/api/subscribe";
136-
137+
137138
let response = Request::post(api_url)
138139
.header("Content-Type", "application/json")
139140
.json(&json!({ "email": email }))
140-
.map_err(|e| format!("Failed to create request: {}", e))?
141+
.map_err(|e| format!("Failed to create request: {e}"))?
141142
.send()
142143
.await
143-
.map_err(|e| format!("Network error: {}", e))?;
144+
.map_err(|e| format!("Network error: {e}"))?;
144145

145146
if response.ok() {
146147
Ok(())
@@ -153,7 +154,7 @@ async fn subscribe_to_newsletter(email: String) -> Result<(), String> {
153154
.unwrap_or("Subscription failed");
154155
Err(error_msg.to_string())
155156
}
156-
Err(_) => Err("Subscription failed. Please try again.".to_string())
157+
Err(_) => Err("Subscription failed. Please try again.".to_string()),
157158
}
158159
}
159160
}
@@ -166,8 +167,8 @@ fn event_target_value(ev: &leptos::ev::Event) -> String {
166167
}
167168

168169
#[cfg(not(target_arch = "wasm32"))]
169-
fn spawn_local<F>(_future: F)
170+
fn spawn_local<F>(_future: F)
170171
where
171172
F: std::future::Future<Output = ()> + 'static,
172173
{
173-
}
174+
}

src/components/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ mod analysis;
22
mod app;
33
mod copy_to_clipboard;
44
mod dropdown;
5-
mod navigation;
65
mod footer;
76
mod navbar;
7+
mod navigation;
88
mod program_window;
99
mod run_window;
1010
mod state;

src/components/navigation.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ pub fn Navigation() -> impl IntoView {
129129
</div>
130130

131131
// Mobile Menu
132-
<div
132+
<div
133133
class="navigation-mobile-menu"
134134
class:active=move || mobile_menu_open.get()
135135
>
136136
<div class="navigation-mobile-section">
137137
<button class="navigation-mobile-dropdown-button" on:click=toggle_docs>"Docs" <i class="fa fa-chevron-down"></i></button>
138-
<div
139-
class="navigation-mobile-dropdown"
138+
<div
139+
class="navigation-mobile-dropdown"
140140
class:active=move || docs_open.get()
141141
>
142142
<a href="https://blockstream.com/simplicity.pdf" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"Whitepaper"</a>
@@ -148,8 +148,8 @@ pub fn Navigation() -> impl IntoView {
148148

149149
<div class="navigation-mobile-section">
150150
<button class="navigation-mobile-dropdown-button" on:click=toggle_packages>"Packages" <i class="fa fa-chevron-down"></i></button>
151-
<div
152-
class="navigation-mobile-dropdown"
151+
<div
152+
class="navigation-mobile-dropdown"
153153
class:active=move || packages_open.get()
154154
>
155155
<a href="https://github.com/BlockstreamResearch/simplicity" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"Simplicity"</a>
@@ -160,8 +160,8 @@ pub fn Navigation() -> impl IntoView {
160160

161161
<div class="navigation-mobile-section">
162162
<button class="navigation-mobile-dropdown-button" on:click=toggle_learn>"Learn" <i class="fa fa-chevron-down"></i></button>
163-
<div
164-
class="navigation-mobile-dropdown"
163+
<div
164+
class="navigation-mobile-dropdown"
165165
class:active=move || learn_open.get()
166166
>
167167
<a href="https://simplicity-lang.org/articles" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"Articles"</a>
@@ -171,8 +171,8 @@ pub fn Navigation() -> impl IntoView {
171171

172172
<div class="navigation-mobile-section">
173173
<button class="navigation-mobile-dropdown-button" on:click=toggle_community>"Community" <i class="fa fa-chevron-down"></i></button>
174-
<div
175-
class="navigation-mobile-dropdown"
174+
<div
175+
class="navigation-mobile-dropdown"
176176
class:active=move || community_open.get()
177177
>
178178
<a href="https://x.com/blksresearch" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item navigation-mobile-dropdown-item-community" on:click=close_mobile_menu>
@@ -188,4 +188,4 @@ pub fn Navigation() -> impl IntoView {
188188
</div>
189189
</nav>
190190
}
191-
}
191+
}

src/components/program_window/examples_dropdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn select_example(example: Example) {
2727
&hashed_data.preimages,
2828
signed_data.sighash_all.get_untracked(),
2929
);
30-
let satisfied_text = format!("{witness}\n\n{}", program_text);
30+
let satisfied_text = format!("{witness}\n\n{program_text}");
3131
program.text.set(satisfied_text);
3232
active_run_tab.0.update(|_| {}); // refresh active tab
3333
}

src/components/program_window/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ pub fn ProgramWindow() -> impl IntoView {
3838
<HelpButton />
3939
</div>
4040

41-
<div
42-
class="hamburger-container"
41+
<div
42+
class="hamburger-container"
4343
class:hamburger-active=mobile_open
4444
on:click=move |_| set_mobile_open.set(!mobile_open.get())
4545
>

src/components/run_window/hash_store_tab.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn CopyHashesToClipboard() -> impl IntoView {
3333
let hashed_data = use_context::<HashedData>().expect("hashed data should exist in context");
3434
let hash_count = use_context::<HashCount>().expect("hash count should exist in context");
3535
let copy_single_hash = move |index: usize| -> View {
36-
let label = format!("Hash {}", index);
36+
let label = format!("Hash {index}");
3737
let hash_hex = move || format!("0x{}", hashed_data.hashes[index].to_byte_array().as_hex());
3838

3939
view! {
@@ -91,7 +91,7 @@ fn CopyPreimagesToClipboard() -> impl IntoView {
9191
let hashed_data = use_context::<HashedData>().expect("hashed data should exist in context");
9292
let hash_count = use_context::<HashCount>().expect("hash count should exist in context");
9393
let copy_single_preimage = move |index: usize| -> View {
94-
let label = format!("Pre {}", index);
94+
let label = format!("Pre {index}");
9595
let preimage_hex = move || format!("0x{}", hashed_data.preimages[index].as_hex());
9696

9797
view! {

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ impl<M: node::Marker> fmt::Display for DisplayInner<'_, M> {
140140
Inner::Disconnect(_, _) => f.write_str("disconnect"),
141141
Inner::Witness(_) => f.write_str("witness"),
142142
Inner::Fail(_) => f.write_str("fail"),
143-
Inner::Jet(jet) => write!(f, "jet_{}", jet),
144-
Inner::Word(value) => write!(f, "const {}", value),
143+
Inner::Jet(jet) => write!(f, "jet_{jet}"),
144+
Inner::Word(value) => write!(f, "const {value}"),
145145
}
146146
}
147147
}

0 commit comments

Comments
 (0)