mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 00:00:05 +03:00
cargo fmt --all --check
This commit is contained in:
parent
e5f0a8f997
commit
275071b740
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue