-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently this only provides the feature to auto-update the nightly version in the `rust-toolchain` file and the `clippy_utils/README.md` file. The actual sync to and from the Rust repo will be added with the move to Josh.
- Loading branch information
Showing
4 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::fmt::Write; | ||
use std::path::Path; | ||
|
||
use chrono::offset::Utc; | ||
|
||
use crate::utils::{UpdateMode, replace_region_in_file}; | ||
|
||
pub fn update_nightly() { | ||
// Update rust-toolchain nightly version | ||
let date = Utc::now().format("%Y-%m-%d").to_string(); | ||
replace_region_in_file( | ||
UpdateMode::Change, | ||
Path::new("rust-toolchain"), | ||
"# begin autogenerated nightly\n", | ||
"# end autogenerated nightly", | ||
|res| { | ||
writeln!(res, "channel = \"nightly-{date}\"").unwrap(); | ||
}, | ||
); | ||
|
||
// Update clippy_utils nightly version | ||
replace_region_in_file( | ||
UpdateMode::Change, | ||
Path::new("clippy_utils/README.md"), | ||
"<!-- begin autogenerated nightly -->\n", | ||
"<!-- end autogenerated nightly -->", | ||
|res| { | ||
writeln!(res, "```").unwrap(); | ||
writeln!(res, "nightly-{date}").unwrap(); | ||
writeln!(res, "```").unwrap(); | ||
}, | ||
); | ||
} |