Fix format and clippy

This commit is contained in:
Aster 2022-02-10 04:02:09 +08:00
parent ce628e1197
commit 6271221940
5 changed files with 27 additions and 29 deletions

8
rustfmt.toml Normal file
View file

@ -0,0 +1,8 @@
version = "Two"
edition = "2018"
imports_granularity = "Crate"
#use_small_heuristics = "Max"
#control_brace_style = "ClosingNextLine"
normalize_comments = true
format_code_in_doc_comments = true

View file

@ -11,13 +11,11 @@ use std::{
use wasm_bindgen_cli_support::Bindgen;
pub fn build(config: &CrateConfig) -> Result<()> {
/*
[1] Build the project with cargo, generating a wasm32-unknown-unknown target (is there a more specific, better target to leverage?)
[2] Generate the appropriate build folders
[3] Wasm-bindgen the .wasm fiile, and move it into the {builddir}/modules/xxxx/xxxx_bg.wasm
[4] Wasm-opt the .wasm file with whatever optimizations need to be done
[5] Link up the html page to the wasm module
*/
// [1] Build the project with cargo, generating a wasm32-unknown-unknown target (is there a more specific, better target to leverage?)
// [2] Generate the appropriate build folders
// [3] Wasm-bindgen the .wasm fiile, and move it into the {builddir}/modules/xxxx/xxxx_bg.wasm
// [4] Wasm-opt the .wasm file with whatever optimizations need to be done
// [5] Link up the html page to the wasm module
let CrateConfig {
out_dir,

View file

@ -1,6 +1,5 @@
use super::*;
/// Build the Rust WASM app and all of its assets.
#[derive(Clone, Debug, Deserialize, Subcommand)]
#[clap(name = "config")]

View file

@ -6,30 +6,25 @@ pub mod create;
pub mod serve;
pub mod translate;
use crate::custom_error;
use crate::{cfg::ConfigOptsBuild, gen_page};
use crate::{cfg::ConfigOptsServe, server, CrateConfig};
use crate::{error::Result, Error};
use clap::Parser;
use html_parser::Dom;
use html_parser::Element;
use html_parser::Node;
use crate::{
cfg::{ConfigOptsBuild, ConfigOptsServe},
custom_error,
error::Result,
gen_page, server, CrateConfig, Error,
};
use clap::{Parser, Subcommand};
use html_parser::{Dom, Element, Node};
use regex::Regex;
use serde::Deserialize;
use std::fmt::{Display, Formatter};
use std::fs::File;
use std::io::Read;
use std::process::exit;
use std::{
fs::remove_dir_all,
process::{Command, Stdio},
fmt::{Display, Formatter},
fs::{remove_dir_all, File},
io::{Read, Write},
path::PathBuf,
process::{exit, Command, Stdio},
};
use std::{io::Write, path::PathBuf};
use clap::{Subcommand};
/// Build, bundle, & ship your Dioxus app.
///
///
#[derive(Parser)]
#[clap(name = "dioxus")]
pub struct Cli {
@ -39,7 +34,6 @@ pub struct Cli {
/// Enable verbose logging.
#[clap(short)]
pub v: bool,
//
// // note: dioxus is still roughly compatible with trunk
// /// Path to the Trunk config file [default: Trunk.toml]
// #[clap(long, parse(from_os_str), env = "TRUNK_CONFIG")]

View file

@ -10,8 +10,7 @@ use notify::{RecommendedWatcher, Watcher};
use std::{path::PathBuf, sync::Arc};
use tower_http::services::ServeDir;
use crate::Result;
use crate::{builder, serve::Serve, CrateConfig};
use crate::{builder, serve::Serve, CrateConfig, Result};
use tokio::sync::broadcast;
struct WsRelodState {