fix: use clippy fix
This commit is contained in:
1 parent
84d1867654
commit
1c2cf3330e
7 files changed
+22
-24
No files matched your search
+2
-2
@@ -187,7 +187,7 @@ pub fn build_desktop(config: &CrateConfig) -> Result<()> {
|
|||||||
.application
|
.application
|
||||||
.out_dir
|
.out_dir
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(PathBuf::from("dist"))
|
.unwrap_or_else(|| PathBuf::from("dist"))
|
||||||
.display()
|
.display()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ pub fn gen_page(config: &DioxusConfig, serve: bool) -> String {
|
|||||||
|
|
||||||
html = html.replace("{app_name}", &config.application.name);
|
html = html.replace("{app_name}", &config.application.name);
|
||||||
|
|
||||||
let title = config.web.app.title.clone().unwrap_or("dioxus | ⛺".into());
|
let title = config.web.app.title.clone().unwrap_or_else(|| "dioxus | ⛺".into());
|
||||||
|
|
||||||
html.replace("{app_title}", &title)
|
html.replace("{app_title}", &title)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
//! Utilities for working with cargo and rust files
|
//! Utilities for working with cargo and rust files
|
||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use std::{env, fs, path::PathBuf, process::Command, str};
|
use std::{env, fs, path::{PathBuf, Path}, process::Command, str};
|
||||||
|
|
||||||
/// How many parent folders are searched for a `Cargo.toml`
|
/// How many parent folders are searched for a `Cargo.toml`
|
||||||
const MAX_ANCESTORS: u32 = 10;
|
const MAX_ANCESTORS: u32 = 10;
|
||||||
@@ -44,7 +44,7 @@ pub fn workspace_root() -> Result<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let stdout = str::from_utf8(&output.stdout).unwrap();
|
let stdout = str::from_utf8(&output.stdout).unwrap();
|
||||||
for line in stdout.lines() {
|
if let Some(line) = stdout.lines().next() {
|
||||||
let meta: serde_json::Value = serde_json::from_str(line)
|
let meta: serde_json::Value = serde_json::from_str(line)
|
||||||
.map_err(|_| Error::CargoError("InvalidOutput".to_string()))?;
|
.map_err(|_| Error::CargoError("InvalidOutput".to_string()))?;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ pub fn workspace_root() -> Result<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the directory contains `Cargo.toml`
|
/// Checks if the directory contains `Cargo.toml`
|
||||||
fn contains_manifest(path: &PathBuf) -> bool {
|
fn contains_manifest(path: &Path) -> bool {
|
||||||
fs::read_dir(path)
|
fs::read_dir(path)
|
||||||
.map(|entries| {
|
.map(|entries| {
|
||||||
entries
|
entries
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ impl Build {
|
|||||||
.application
|
.application
|
||||||
.out_dir
|
.out_dir
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(PathBuf::from("dist")),
|
.unwrap_or_else(|| PathBuf::from("dist")),
|
||||||
)
|
)
|
||||||
.join("index.html"),
|
.join("index.html"),
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ impl Clean {
|
|||||||
.dioxus_config
|
.dioxus_config
|
||||||
.application
|
.application
|
||||||
.out_dir
|
.out_dir
|
||||||
.unwrap_or(PathBuf::from("dist"));
|
.unwrap_or_else(|| PathBuf::from("dist"));
|
||||||
if crate_config.crate_dir.join(&out_dir).is_dir() {
|
if crate_config.crate_dir.join(&out_dir).is_dir() {
|
||||||
remove_dir_all(crate_config.crate_dir.join(&out_dir))?;
|
remove_dir_all(crate_config.crate_dir.join(&out_dir))?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ impl Serve {
|
|||||||
.application
|
.application
|
||||||
.out_dir
|
.out_dir
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(PathBuf::from("dist")),
|
.unwrap_or_else(|| PathBuf::from("dist")),
|
||||||
)
|
)
|
||||||
.join("index.html"),
|
.join("index.html"),
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ impl Translate {
|
|||||||
exit(0);
|
exit(0);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
if temp.is_none() {
|
if let Some(..) = temp {
|
||||||
if let Some(s) = source {
|
if let Some(s) = source {
|
||||||
contents = s;
|
contents = s;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+13
-15
@@ -49,7 +49,7 @@ pub async fn startup(config: CrateConfig) -> anyhow::Result<()> {
|
|||||||
.watcher
|
.watcher
|
||||||
.watch_path
|
.watch_path
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(vec![PathBuf::from("src")]);
|
.unwrap_or_else(|| vec![PathBuf::from("src")]);
|
||||||
let crate_dir = watcher_conf.crate_dir.clone();
|
let crate_dir = watcher_conf.crate_dir.clone();
|
||||||
loop {
|
loop {
|
||||||
if let Ok(v) = rx.recv() {
|
if let Ok(v) = rx.recv() {
|
||||||
@@ -67,21 +67,19 @@ pub async fn startup(config: CrateConfig) -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if reload {
|
if reload && builder::build(&watcher_conf).is_ok() {
|
||||||
if let Ok(_) = builder::build(&watcher_conf) {
|
// change the websocket reload state to true;
|
||||||
// change the websocket reload state to true;
|
// the page will auto-reload.
|
||||||
// the page will auto-reload.
|
if watcher_conf
|
||||||
if watcher_conf
|
.dioxus_config
|
||||||
.dioxus_config
|
.web
|
||||||
.web
|
.watcher
|
||||||
.watcher
|
.reload_html
|
||||||
.reload_html
|
.unwrap_or(false)
|
||||||
.unwrap_or(false)
|
{
|
||||||
{
|
let _ = Serve::regen_dev_page(&watcher_conf);
|
||||||
let _ = Serve::regen_dev_page(&watcher_conf);
|
|
||||||
}
|
|
||||||
watcher_ws_state.lock().unwrap().change();
|
|
||||||
}
|
}
|
||||||
|
watcher_ws_state.lock().unwrap().change();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|||||||
Reference in new issue
Block a user