if possible, use into instead of to_owned
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
This commit is contained in:
parent
39fde5225d
commit
c1f724e8bc
10 changed files with 26 additions and 26 deletions
|
@ -27,9 +27,9 @@ impl FileConfig {
|
|||
/// Initialize with default values
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
scheme: Some("http".to_owned()),
|
||||
scheme: Some("http".into()),
|
||||
port: Some(8080),
|
||||
app_name: Some("EWP".to_owned()),
|
||||
app_name: Some("EWP".into()),
|
||||
..FileConfig::default()
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ pub fn get_config(file_path: &str) -> Config {
|
|||
let static_dir = "static".to_owned();
|
||||
let templates_dir = "templates".to_owned();
|
||||
let files_root = init(
|
||||
"dist".to_owned(),
|
||||
"dist".into(),
|
||||
static_dir.to_owned(),
|
||||
templates_dir.to_owned(),
|
||||
);
|
||||
|
@ -112,7 +112,7 @@ pub fn get_config(file_path: &str) -> Config {
|
|||
fn init(dist_dir: String, static_dir: String, templates_dir: String) -> String {
|
||||
// The static folder is minimized only in release mode
|
||||
if cfg!(debug_assertions) {
|
||||
".".to_owned()
|
||||
".".into()
|
||||
} else {
|
||||
let cfg = minify_html::Cfg {
|
||||
keep_closing_tags: true,
|
||||
|
|
|
@ -67,7 +67,7 @@ pub async fn fetch_pr() -> Result<Vec<Project>, Error> {
|
|||
let mut list = vec![];
|
||||
resp.items.iter().for_each(|p| {
|
||||
list.push(Project {
|
||||
project: p.repository_url.split('/').last().unwrap().to_owned(),
|
||||
project: p.repository_url.split('/').last().unwrap().into(),
|
||||
project_url: p.repository_url.to_owned(),
|
||||
status: if p.pull_request.merged_at.is_none() {
|
||||
if p.state == "closed" {
|
||||
|
|
|
@ -43,11 +43,11 @@ pub fn get_options() -> ComrakOptions {
|
|||
header_ids: Some(String::new()),
|
||||
footnotes: true,
|
||||
description_lists: true,
|
||||
front_matter_delimiter: Some("---".to_owned()),
|
||||
front_matter_delimiter: Some("---".into()),
|
||||
},
|
||||
parse: ComrakParseOptions {
|
||||
smart: true, // could be boring
|
||||
default_info_string: Some("plaintext".to_owned()),
|
||||
default_info_string: Some("plaintext".into()),
|
||||
relaxed_tasklist_matching: true,
|
||||
},
|
||||
render: ComrakRenderOptions {
|
||||
|
@ -86,7 +86,7 @@ pub fn read(raw_text: &str) -> File {
|
|||
metadata: Metadata {
|
||||
info: metadata,
|
||||
mermaid: check_mermaid(root, mermaid_name),
|
||||
syntax_highlight: check_code(root, &[mermaid_name.to_owned()]),
|
||||
syntax_highlight: check_code(root, &[mermaid_name.into()]),
|
||||
math: check_math(&html_content),
|
||||
},
|
||||
content: html_content,
|
||||
|
|
|
@ -51,7 +51,7 @@ pub async fn robots() -> impl Responder {
|
|||
#[once(time = 60)]
|
||||
fn build_robotstxt() -> String {
|
||||
// TODO, see https://www.robotstxt.org/orig.html
|
||||
"User-agent: * Allow: /".to_owned()
|
||||
"User-agent: * Allow: /".into()
|
||||
}
|
||||
|
||||
#[get("/sitemap.xml")]
|
||||
|
|
|
@ -39,8 +39,8 @@ pub fn build_index(config: Config) -> String {
|
|||
posts,
|
||||
},
|
||||
Infos {
|
||||
page_title: Some("Blog".to_owned()),
|
||||
page_desc: Some("Liste des posts d'Anri".to_owned()),
|
||||
page_title: Some("Blog".into()),
|
||||
page_desc: Some("Liste des posts d'Anri".into()),
|
||||
page_kw: Some(["blog", "blogging"].join(", ")),
|
||||
},
|
||||
)
|
||||
|
@ -80,19 +80,19 @@ fn get_posts(location: &str) -> Vec<Post> {
|
|||
|
||||
metadata.title = match metadata.title {
|
||||
Some(title) => Some(title),
|
||||
None => Some(file_without_ext.to_owned()),
|
||||
None => Some(file_without_ext.into()),
|
||||
};
|
||||
|
||||
metadata
|
||||
}
|
||||
Err(_) => FileMetadata {
|
||||
title: Some(file_without_ext.to_owned()),
|
||||
title: Some(file_without_ext.into()),
|
||||
..FileMetadata::default()
|
||||
},
|
||||
};
|
||||
|
||||
Post {
|
||||
url: file_without_ext.to_owned(),
|
||||
url: file_without_ext.into(),
|
||||
title: file_metadata.title.unwrap(),
|
||||
date: file_metadata.date.unwrap_or({
|
||||
let m = f.metadata().unwrap();
|
||||
|
@ -148,7 +148,7 @@ fn get_post(post: &mut Option<File>, filename: String) -> Infos {
|
|||
|
||||
Infos {
|
||||
page_title: Some(format!("Post: {}", title)),
|
||||
page_desc: Some("Blog d'Anri".to_owned()),
|
||||
page_desc: Some("Blog d'Anri".into()),
|
||||
page_kw: Some(["blog", "blogging", "write", "writing"].join(", ")),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ pub async fn build_page(config: Config) -> String {
|
|||
map.entry(project_name).and_modify(|v| v.push(project));
|
||||
} else {
|
||||
data.push(Project {
|
||||
name: project_name.to_owned(),
|
||||
name: project_name.into(),
|
||||
url: p.project_url.to_owned(),
|
||||
pulls_merged: Vec::new(),
|
||||
pulls_closed: Vec::new(),
|
||||
|
@ -140,8 +140,8 @@ pub async fn build_page(config: Config) -> String {
|
|||
"contrib.html",
|
||||
data,
|
||||
Infos {
|
||||
page_title: Some("Mes contributions".to_owned()),
|
||||
page_desc: Some("Contributions à l'opensource par Anri".to_owned()),
|
||||
page_title: Some("Mes contributions".into()),
|
||||
page_desc: Some("Contributions à l'opensource par Anri".into()),
|
||||
page_kw: None,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -14,8 +14,8 @@ pub fn build_page(config: Config) -> String {
|
|||
"index.html",
|
||||
(),
|
||||
Infos {
|
||||
page_title: Some("Mylloon".to_owned()),
|
||||
page_desc: Some("Page principale".to_owned()),
|
||||
page_title: Some("Mylloon".into()),
|
||||
page_desc: Some("Page principale".into()),
|
||||
page_kw: None,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -14,8 +14,8 @@ pub fn build_page(config: Config) -> String {
|
|||
"networks.html",
|
||||
(),
|
||||
Infos {
|
||||
page_title: Some("Mes réseaux".to_owned()),
|
||||
page_desc: Some("Réseaux d'Anri".to_owned()),
|
||||
page_title: Some("Mes réseaux".into()),
|
||||
page_desc: Some("Réseaux d'Anri".into()),
|
||||
page_kw: None,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -75,8 +75,8 @@ pub fn build_page(config: Config) -> String {
|
|||
err_msg: "is empty",
|
||||
},
|
||||
Infos {
|
||||
page_title: Some("Portfolio".to_owned()),
|
||||
page_desc: Some("Portfolio d'Anri".to_owned()),
|
||||
page_title: Some("Portfolio".into()),
|
||||
page_desc: Some("Portfolio d'Anri".into()),
|
||||
page_kw: None,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -14,8 +14,8 @@ pub fn build_page(config: Config) -> String {
|
|||
"web3.html",
|
||||
(),
|
||||
Infos {
|
||||
page_title: Some("Mylloon".to_owned()),
|
||||
page_desc: Some("Coin reculé de l'internet".to_owned()),
|
||||
page_title: Some("Mylloon".into()),
|
||||
page_desc: Some("Coin reculé de l'internet".into()),
|
||||
page_kw: None,
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue