fix clippy

This commit is contained in:
Evan Almloff committed 2023-10-20 09:38:10 -05:00
1 parent 1d664c616e
commit 33f0f0c172
8 files changed
+7 -9

No files matched your search

+1 -1
View File
@@ -312,7 +312,7 @@ pub fn build_desktop(config: &CrateConfig, _is_serve: bool) -> Result<BuildResul
if !config.out_dir.is_dir() { if !config.out_dir.is_dir() {
create_dir_all(&config.out_dir)?; create_dir_all(&config.out_dir)?;
} }
copy(res_path, &config.out_dir.join(target_file))?; copy(res_path, config.out_dir.join(target_file))?;
// this code will copy all public file to the output dir // this code will copy all public file to the output dir
if config.asset_dir.is_dir() { if config.asset_dir.is_dir() {
+1 -1
View File
@@ -128,7 +128,7 @@ impl ScopeContext {
parent.name parent.name
); );
if let Some(shared) = parent.shared_contexts.borrow().iter().find_map(|any| { if let Some(shared) = parent.shared_contexts.borrow().iter().find_map(|any| {
tracing::trace!("found context {:?}", any.type_id()); tracing::trace!("found context {:?}", (**any).type_id());
any.downcast_ref::<T>() any.downcast_ref::<T>()
}) { }) {
return Some(shared.clone()); return Some(shared.clone());
+1 -1
View File
@@ -484,7 +484,7 @@ fn apply_edits(
HydrateText { path, value, id } => channel.hydrate_text(path, value, id.0 as u32), HydrateText { path, value, id } => channel.hydrate_text(path, value, id.0 as u32),
LoadTemplate { name, index, id } => { LoadTemplate { name, index, id } => {
if let Some(tmpl_id) = templates.get(name) { if let Some(tmpl_id) = templates.get(name) {
channel.load_template(*tmpl_id as u16, index as u16, id.0 as u32) channel.load_template(*tmpl_id, index as u16, id.0 as u32)
} }
} }
ReplaceWith { id, m } => channel.replace_with(id.0 as u32, m as u16), ReplaceWith { id, m } => channel.replace_with(id.0 as u32, m as u16),
+1 -2
View File
@@ -126,7 +126,6 @@ pub(super) fn desktop_handler(
{ {
Ok(response) => { Ok(response) => {
responder.respond(response); responder.respond(response);
return;
} }
Err(err) => tracing::error!("error building response: {}", err), Err(err) => tracing::error!("error building response: {}", err),
} }
@@ -167,7 +166,7 @@ fn get_asset_root() -> Option<PathBuf> {
/// Get the mime type from a path-like string /// Get the mime type from a path-like string
fn get_mime_from_path(trimmed: &Path) -> Result<&'static str> { fn get_mime_from_path(trimmed: &Path) -> Result<&'static str> {
if trimmed.ends_with(".svg") { if trimmed.extension().is_some_and(|ext| ext == "svg") {
return Ok("image/svg+xml"); return Ok("image/svg+xml");
} }
+1 -1
View File
@@ -23,5 +23,5 @@ default = []
serialize = ["serde"] serialize = ["serde"]
sledgehammer = ["sledgehammer_bindgen", "sledgehammer_utils"] sledgehammer = ["sledgehammer_bindgen", "sledgehammer_utils"]
web = ["sledgehammer", "wasm-bindgen", "js-sys", "web-sys", "sledgehammer_bindgen/web"] web = ["sledgehammer", "wasm-bindgen", "js-sys", "web-sys", "sledgehammer_bindgen/web"]
binary-protocol = ["sledgehammer"] binary-protocol = ["sledgehammer", "wasm-bindgen"]
minimal_bindings = [] minimal_bindings = []
+1 -1
View File
@@ -329,7 +329,7 @@ fn apply_edits(
HydrateText { path, value, id } => channel.hydrate_text(path, value, id.0 as u32), HydrateText { path, value, id } => channel.hydrate_text(path, value, id.0 as u32),
LoadTemplate { name, index, id } => { LoadTemplate { name, index, id } => {
if let Some(tmpl_id) = templates.get(name) { if let Some(tmpl_id) = templates.get(name) {
channel.load_template(*tmpl_id as u16, index as u16, id.0 as u32) channel.load_template(*tmpl_id, index as u16, id.0 as u32)
} }
} }
ReplaceWith { id, m } => channel.replace_with(id.0 as u32, m as u16), ReplaceWith { id, m } => channel.replace_with(id.0 as u32, m as u16),
+1 -1
View File
@@ -105,7 +105,7 @@ pub fn server(args: proc_macro::TokenStream, s: TokenStream) -> TokenStream {
let upper_cammel_case_name = Converter::new() let upper_cammel_case_name = Converter::new()
.from_case(Case::Snake) .from_case(Case::Snake)
.to_case(Case::UpperCamel) .to_case(Case::UpperCamel)
.convert(&sig.ident.to_string()); .convert(sig.ident.to_string());
args.struct_name = Some(Ident::new(&upper_cammel_case_name, sig.ident.span())); args.struct_name = Some(Ident::new(&upper_cammel_case_name, sig.ident.span()));
} }
let struct_name = args.struct_name.as_ref().unwrap(); let struct_name = args.struct_name.as_ref().unwrap();
-1
View File
@@ -13,7 +13,6 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
dioxus-core = { workspace = true, features = ["serialize"] } dioxus-core = { workspace = true, features = ["serialize"] }
dioxus-html = { workspace = true, features = ["wasm-bind"] } dioxus-html = { workspace = true, features = ["wasm-bind"] }
dioxus-interpreter-js = { workspace = true, features = [ dioxus-interpreter-js = { workspace = true, features = [
"sledgehammer",
"minimal_bindings", "minimal_bindings",
"web", "web",
] } ] }