From 275071b740cabd833eb2d4fa851bcef1ce2851ff Mon Sep 17 00:00:00 2001 From: manmen-mi Date: Sun, 8 Dec 2024 12:05:21 +0900 Subject: [PATCH] `cargo fmt --all --check` --- src/app_state.rs | 4 +--- src/main.rs | 2 +- src/url_replacer.rs | 14 +++++++------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/app_state.rs b/src/app_state.rs index e8d1bd1a..1c623075 100644 --- a/src/app_state.rs +++ b/src/app_state.rs @@ -83,9 +83,7 @@ impl AppState { })?; // replacer for rustbook url - let url_replacer = base_url.as_ref().map(|url| { - UrlReplacer::new(url) - }); + let url_replacer = base_url.as_ref().map(|url| UrlReplacer::new(url)); let dir_canonical_path = term::canonicalize("exercises"); let mut exercises = exercise_infos diff --git a/src/main.rs b/src/main.rs index a7941d28..a46f9fa1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,8 +21,8 @@ mod init; mod list; mod run; mod term; -mod watch; mod url_replacer; +mod watch; const CURRENT_FORMAT_VERSION: u8 = 1; diff --git a/src/url_replacer.rs b/src/url_replacer.rs index 0499372f..3a3537a5 100644 --- a/src/url_replacer.rs +++ b/src/url_replacer.rs @@ -1,5 +1,5 @@ pub struct UrlReplacer { - base_url: String + base_url: String, } const EN_BASE_URL: &str = "https://doc.rust-lang.org/book"; @@ -13,9 +13,7 @@ impl UrlReplacer { base_url.to_owned() }; - Self { - base_url: url - } + Self { base_url: url } } /// replace rustbook url @@ -41,7 +39,6 @@ link: https://example.com/ch03-02-data-types.html"; assert_eq!(hint, replacer.replace(hint)); } - #[test] fn replace_rustbook_url() { let replacer = UrlReplacer::new(&String::from(TEST_DOMAIN)); @@ -50,9 +47,12 @@ link: https://example.com/ch03-02-data-types.html"; hints (...) lines (...) link: https://doc.rust-lang.org/book/ch03-02-data-types.html"; - assert_eq!("\ + assert_eq!( + "\ hints (...) lines (...) -link: https://doc.rust-kr.org/ch03-02-data-types.html", replacer.replace(hint)); +link: https://doc.rust-kr.org/ch03-02-data-types.html", + replacer.replace(hint) + ); } #[test]