diff --git a/src/config.rs b/src/config.rs index 522b4bb..3c66fce 100644 --- a/src/config.rs +++ b/src/config.rs @@ -20,9 +20,9 @@ pub struct FileConfig { impl FileConfig { fn new() -> Self { Self { - scheme: Some("http".to_string()), + scheme: Some("http".to_owned()), port: Some(8080), - app_name: Some("EWP".to_string()), + app_name: Some("EWP".to_owned()), ..FileConfig::default() } } @@ -77,13 +77,9 @@ fn get_file_config(file_path: &str) -> FileConfig { pub fn get_config(file_path: &str) -> Config { let internal_config = get_file_config(file_path); - let static_dir = "static".to_string(); - let templates_dir = "templates".to_string(); - let files_root = init( - "dist".to_string(), - static_dir.clone(), - templates_dir.clone(), - ); + let static_dir = "static".to_owned(); + let templates_dir = "templates".to_owned(); + let files_root = init("dist".to_owned(), static_dir.clone(), templates_dir.clone()); Config { fc: internal_config.clone(), @@ -98,7 +94,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_string() + ".".to_owned() } else { let cfg = Cfg { keep_closing_tags: true, diff --git a/src/misc/github.rs b/src/misc/github.rs index 04af673..2d7736a 100644 --- a/src/misc/github.rs +++ b/src/misc/github.rs @@ -67,7 +67,7 @@ pub async fn fetch_pr() -> Result, Error> { let mut list = vec![]; resp.items.iter().for_each(|p| { list.push(Project { - project: p.repository_url.split('/').last().unwrap().to_string(), + project: p.repository_url.split('/').last().unwrap().to_owned(), project_url: p.repository_url.clone(), status: if p.pull_request.merged_at.is_none() { if p.state == "closed" { diff --git a/src/misc/markdown.rs b/src/misc/markdown.rs index 4a67efa..014ff89 100644 --- a/src/misc/markdown.rs +++ b/src/misc/markdown.rs @@ -42,7 +42,7 @@ pub fn get_options() -> ComrakOptions { header_ids: Some(String::new()), footnotes: false, // true? description_lists: true, - front_matter_delimiter: Some("---".to_string()), + front_matter_delimiter: Some("---".to_owned()), }, parse: ComrakParseOptions { smart: false, // true one day? @@ -80,8 +80,8 @@ pub fn read(raw_text: &str) -> File { File { metadata: Metadata { info: metadata, - mermaid: check_mermaid(root, mermaid_name.to_string()), - syntax_highlight: check_code(root, &[mermaid_name.to_string()]), + mermaid: check_mermaid(root, mermaid_name.to_owned()), + syntax_highlight: check_code(root, &[mermaid_name.to_owned()]), }, content: String::from_utf8(html).unwrap(), } diff --git a/src/routes/agreements.rs b/src/routes/agreements.rs index 674b65c..d529d2e 100644 --- a/src/routes/agreements.rs +++ b/src/routes/agreements.rs @@ -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_string() + "User-agent: * Allow: /".to_owned() } #[get("/sitemap.xml")] diff --git a/src/routes/blog.rs b/src/routes/blog.rs index 0e11613..c96226f 100644 --- a/src/routes/blog.rs +++ b/src/routes/blog.rs @@ -37,8 +37,8 @@ pub fn build_index(config: Config) -> String { posts: if posts.is_empty() { None } else { Some(posts) }, }, Infos { - page_title: Some("Blog".to_string()), - page_desc: Some("Liste des posts d'Anri".to_string()), + page_title: Some("Blog".to_owned()), + page_desc: Some("Liste des posts d'Anri".to_owned()), page_kw: Some(["blog", "blogging"].join(", ")), }, ) @@ -75,20 +75,20 @@ fn get_posts(location: &str) -> Vec { metadata.title = match metadata.title { Some(title) => Some(title), - None => Some(file_without_ext.to_string()), + None => Some(file_without_ext.to_owned()), }; metadata } Err(_) => FileMetadata { - title: Some(file_without_ext.to_string()), + title: Some(file_without_ext.to_owned()), link: None, date: None, }, }; Post { - url: file_without_ext.to_string(), + url: file_without_ext.to_owned(), title: file_metadata.title.unwrap(), date: file_metadata.date.unwrap_or({ let m = f.metadata().unwrap(); @@ -143,7 +143,7 @@ fn get_post(post: &mut Option, filename: String) -> Infos { Infos { page_title: Some(format!("Post: {}", title)), - page_desc: Some("Blog d'Anri".to_string()), + page_desc: Some("Blog d'Anri".to_owned()), page_kw: Some(["blog", "blogging", "write", "writing"].join(", ")), } } diff --git a/src/routes/contrib.rs b/src/routes/contrib.rs index 2acebba..9cee097 100644 --- a/src/routes/contrib.rs +++ b/src/routes/contrib.rs @@ -60,7 +60,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_string(), + name: project_name.to_owned(), url: p.project_url.clone(), pulls_merged: Vec::new(), pulls_closed: Vec::new(), @@ -138,8 +138,8 @@ pub async fn build_page(config: Config) -> String { "contrib.html", data, Infos { - page_title: Some("Mes contributions".to_string()), - page_desc: Some("Contributions à l'opensource par Anri".to_string()), + page_title: Some("Mes contributions".to_owned()), + page_desc: Some("Contributions à l'opensource par Anri".to_owned()), page_kw: None, }, ) diff --git a/src/routes/index.rs b/src/routes/index.rs index e70b805..2e50e81 100644 --- a/src/routes/index.rs +++ b/src/routes/index.rs @@ -18,8 +18,8 @@ pub fn build_page(config: Config) -> String { "index.html", IndexTemplate {}, Infos { - page_title: Some("Mylloon".to_string()), - page_desc: Some("Page principale".to_string()), + page_title: Some("Mylloon".to_owned()), + page_desc: Some("Page principale".to_owned()), page_kw: None, }, ) diff --git a/src/routes/networks.rs b/src/routes/networks.rs index acd3a68..6896088 100644 --- a/src/routes/networks.rs +++ b/src/routes/networks.rs @@ -18,8 +18,8 @@ pub fn build_page(config: Config) -> String { "networks.html", NetworksTemplate {}, Infos { - page_title: Some("Mes réseaux".to_string()), - page_desc: Some("Réseaux d'Anri".to_string()), + page_title: Some("Mes réseaux".to_owned()), + page_desc: Some("Réseaux d'Anri".to_owned()), page_kw: None, }, ) diff --git a/src/routes/portfolio.rs b/src/routes/portfolio.rs index 021d4d0..7090b88 100644 --- a/src/routes/portfolio.rs +++ b/src/routes/portfolio.rs @@ -75,8 +75,8 @@ pub fn build_page(config: Config) -> String { err_msg: "is empty", }, Infos { - page_title: Some("Portfolio".to_string()), - page_desc: Some("Portfolio d'Anri".to_string()), + page_title: Some("Portfolio".to_owned()), + page_desc: Some("Portfolio d'Anri".to_owned()), page_kw: None, }, ) diff --git a/src/routes/web3.rs b/src/routes/web3.rs index 3ee0f57..9f120f8 100644 --- a/src/routes/web3.rs +++ b/src/routes/web3.rs @@ -18,8 +18,8 @@ pub fn build_page(config: Config) -> String { "web3.html", Web3Template {}, Infos { - page_title: Some("Mylloon".to_string()), - page_desc: Some("Coin reculé de l'internet".to_string()), + page_title: Some("Mylloon".to_owned()), + page_desc: Some("Coin reculé de l'internet".to_owned()), page_kw: None, }, )