Fix format and clippy

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

No files matched your search

+8
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
+5 -7
View File
@@ -11,13 +11,11 @@ use std::{
use wasm_bindgen_cli_support::Bindgen; use wasm_bindgen_cli_support::Bindgen;
pub fn build(config: &CrateConfig) -> Result<()> { 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?)
[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
[2] Generate the appropriate build folders // [3] Wasm-bindgen the .wasm fiile, and move it into the {builddir}/modules/xxxx/xxxx_bg.wasm
[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
[4] Wasm-opt the .wasm file with whatever optimizations need to be done // [5] Link up the html page to the wasm module
[5] Link up the html page to the wasm module
*/
let CrateConfig { let CrateConfig {
out_dir, out_dir,
-1
View File
@@ -1,6 +1,5 @@
use super::*; use super::*;
/// Build the Rust WASM app and all of its assets. /// Build the Rust WASM app and all of its assets.
#[derive(Clone, Debug, Deserialize, Subcommand)] #[derive(Clone, Debug, Deserialize, Subcommand)]
#[clap(name = "config")] #[clap(name = "config")]
+13 -19
View File
@@ -6,30 +6,25 @@ pub mod create;
pub mod serve; pub mod serve;
pub mod translate; pub mod translate;
use crate::custom_error; use crate::{
use crate::{cfg::ConfigOptsBuild, gen_page}; cfg::{ConfigOptsBuild, ConfigOptsServe},
use crate::{cfg::ConfigOptsServe, server, CrateConfig}; custom_error,
use crate::{error::Result, Error}; error::Result,
use clap::Parser; gen_page, server, CrateConfig, Error,
use html_parser::Dom; };
use html_parser::Element; use clap::{Parser, Subcommand};
use html_parser::Node; use html_parser::{Dom, Element, Node};
use regex::Regex; use regex::Regex;
use serde::Deserialize; use serde::Deserialize;
use std::fmt::{Display, Formatter};
use std::fs::File;
use std::io::Read;
use std::process::exit;
use std::{ use std::{
fs::remove_dir_all, fmt::{Display, Formatter},
process::{Command, Stdio}, 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. /// Build, bundle, & ship your Dioxus app.
///
///
#[derive(Parser)] #[derive(Parser)]
#[clap(name = "dioxus")] #[clap(name = "dioxus")]
pub struct Cli { pub struct Cli {
@@ -39,7 +34,6 @@ pub struct Cli {
/// Enable verbose logging. /// Enable verbose logging.
#[clap(short)] #[clap(short)]
pub v: bool, pub v: bool,
//
// // note: dioxus is still roughly compatible with trunk // // note: dioxus is still roughly compatible with trunk
// /// Path to the Trunk config file [default: Trunk.toml] // /// Path to the Trunk config file [default: Trunk.toml]
// #[clap(long, parse(from_os_str), env = "TRUNK_CONFIG")] // #[clap(long, parse(from_os_str), env = "TRUNK_CONFIG")]
+1 -2
View File
@@ -10,8 +10,7 @@ use notify::{RecommendedWatcher, Watcher};
use std::{path::PathBuf, sync::Arc}; use std::{path::PathBuf, sync::Arc};
use tower_http::services::ServeDir; use tower_http::services::ServeDir;
use crate::Result; use crate::{builder, serve::Serve, CrateConfig, Result};
use crate::{builder, serve::Serve, CrateConfig};
use tokio::sync::broadcast; use tokio::sync::broadcast;
struct WsRelodState { struct WsRelodState {