Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelleyrtp committed Jan 31, 2025
1 parent b47689c commit 2a65c4f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/desktop/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub(super) fn desktop_handler(
}
}

match dioxus_asset_resolver::serve_asset_from_raw_path(&request.uri().path()) {
match dioxus_asset_resolver::serve_asset_from_raw_path(request.uri().path()) {
Ok(res) => responder.respond(res),
Err(_e) => responder.respond(
Response::builder()
Expand Down
13 changes: 9 additions & 4 deletions packages/dioxus/src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ use crate::prelude::*;
///
/// # Example
/// ```rust, no_run
/// use dioxus::prelude::*;
/// # use dioxus::prelude::*;
///
/// fn main() {
/// dioxus::launch(app);
/// dioxus::launch(app);
/// fn app() -> Element {
/// rsx! {
/// div { "Hello, world!" }
/// }
/// }
/// ```
pub fn launch(app: fn() -> Element) {
Expand Down Expand Up @@ -219,6 +222,8 @@ impl LaunchBuilder {
}

/// Launch your application.
///
#[allow(clippy::diverging_sub_expression)]
pub fn launch(self, app: fn() -> Element) {
let Self {
platform,
Expand All @@ -231,7 +236,7 @@ impl LaunchBuilder {
dioxus_logger::initialize_default();

// Set any flags if we're running under fullstack
#[cfg(all(feature = "fullstack"))]
#[cfg(feature = "fullstack")]
{
use dioxus_fullstack::prelude::server_fn::client::{get_server_url, set_server_url};

Expand Down
2 changes: 1 addition & 1 deletion packages/native/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl NetProvider for DioxusNativeNetProvider {
handler: blitz_traits::net::BoxedHandler<Self::Data>,
) {
if request.url.scheme() == "dioxus" {
match dioxus_asset_resolver::serve_asset_from_raw_path(&request.url.path()) {
match dioxus_asset_resolver::serve_asset_from_raw_path(request.url.path()) {
Ok(res) => {
println!("fetching asset from file system success {request:#?}");
handler.bytes(doc_id, res.into_body().into(), self.callback.clone())
Expand Down
2 changes: 1 addition & 1 deletion packages/native/src/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Document for DioxusNativeDocument {
DioxusNativeEvent::CreateHeadElement {
name: name.to_string(),
attributes: attributes
.into_iter()
.iter()
.map(|(name, value)| (name.to_string(), value.clone()))
.collect(),
contents,
Expand Down
2 changes: 1 addition & 1 deletion packages/native/src/dioxus_application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl DioxusNativeApplication {
contents,
window,
} => {
if let Some(window) = self.inner.windows.get_mut(&window) {
if let Some(window) = self.inner.windows.get_mut(window) {
window.doc.create_head_element(name, attributes, contents);
window.poll();
}
Expand Down
5 changes: 2 additions & 3 deletions packages/native/src/dioxus_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,7 @@ impl DioxusDocument {
title = attributes
.iter()
.find(|(name, _value)| name == "text")
.map(|(_name, _value)| contents.clone())
.flatten();
.and_then(|(_name, _value)| contents.clone());
}

let attributes = attributes
Expand All @@ -525,7 +524,7 @@ impl DioxusDocument {
)));

if let Some(contents) = contents {
let text_node = self.inner.create_text_node(&contents);
let text_node = self.inner.create_text_node(contents);
self.inner
.get_node_mut(new_elememt)

Check warning on line 529 in packages/native/src/dioxus_document.rs

View workflow job for this annotation

GitHub Actions / Check for typos

"elememt" should be "element".
.unwrap()
Expand Down
9 changes: 5 additions & 4 deletions packages/native/src/mutation_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ impl MutationWriter<'_> {
// }

if let Some(src_attr) = node.attr(local_name!("src")) {
crate::assets::fetch_image(&self.doc, id, src_attr.to_string());
crate::assets::fetch_image(self.doc, id, src_attr.to_string());
}

let rel_attr = node.attr(local_name!("rel"));
let href_attr = node.attr(local_name!("href"));
if let (Some("stylesheet"), Some(href)) = (rel_attr, href_attr) {
crate::assets::fetch_linked_stylesheet(&self.doc, id, href.to_string());
crate::assets::fetch_linked_stylesheet(self.doc, id, href.to_string());
}

for &child_id in &child_ids {
Expand Down Expand Up @@ -239,6 +239,7 @@ impl WriteMutations for MutationWriter<'_> {
self.state.stack.push(node_id);
}

#[allow(clippy::map_entry)]
fn load_template(&mut self, template: Template, index: usize, id: ElementId) {
if !self.state.templates.contains_key(&template) {
let template_root_ids: Vec<NodeId> = template
Expand Down Expand Up @@ -420,11 +421,11 @@ impl WriteMutations for MutationWriter<'_> {
}

if let Some(queued_image) = queued_image {
crate::assets::fetch_image(&self.doc, node_id, queued_image);
crate::assets::fetch_image(self.doc, node_id, queued_image);
}

if let Some(queued_stylesheet) = queued_stylesheet {
crate::assets::fetch_linked_stylesheet(&self.doc, node_id, queued_stylesheet);
crate::assets::fetch_linked_stylesheet(self.doc, node_id, queued_stylesheet);
}
}

Expand Down

0 comments on commit 2a65c4f

Please sign in to comment.