Skip to content

Commit a00ec33

Browse files
committed
fixup! Implement sync subcommand in clippy_dev
1 parent ff5a352 commit a00ec33

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

clippy_dev/src/sync.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ use std::process::exit;
66

77
use xshell::{Shell, cmd};
88

9-
const JOSH_FILTER: &str = ":rev(2efebd2f0c03dabbe5c3ad7b4ebfbd99238d1fb2:prefix=src/tools/clippy):/src/tools/clippy";
9+
const JOSH_FILTER: &str = ":rev(53d3bc02ed90eba01c5dbc5b2d0c4cabb67ffb4d:prefix=src/tools/clippy):/src/tools/clippy";
1010
const JOSH_PORT: &str = "42042";
11+
const TOOLCHAIN_TOML: &str = "rust-toolchain.toml";
12+
const UTILS_README: &str = "clippy_utils/README.md";
1113

1214
fn start_josh() -> impl Drop {
1315
// Create a wrapper that stops it on drop.
@@ -96,22 +98,32 @@ pub fn rustc_pull() {
9698

9799
// Update rust-toolchain file
98100
let date = Utc::now().format("%Y-%m-%d").to_string();
99-
let update = &mut update_text_region_fn(
101+
let toolchain_update = &mut update_text_region_fn(
100102
"# begin autogenerated nightly\n",
101103
"# end autogenerated nightly",
102104
|dst| {
103105
writeln!(dst, "channel = \"nightly-{date}\"").unwrap();
104106
},
105107
);
108+
let readme_update = &mut update_text_region_fn(
109+
"<!-- begin autogenerated nightly -->\n",
110+
"<!-- end autogenerated nightly -->",
111+
|dst| {
112+
writeln!(dst, "```\nnightly-{date}\n```").unwrap();
113+
},
114+
);
106115

107116
let mut updater = FileUpdater::default();
108-
updater.update_file("rust-toolchain.toml", update);
109-
updater.update_file("clippy_utils/README.md", update);
117+
updater.update_file(TOOLCHAIN_TOML, toolchain_update);
118+
updater.update_file(UTILS_README, readme_update);
110119

111120
let message = format!("Bump nightly version -> {date}");
112-
cmd!(sh, "git commit rust-toolchain --no-verify -m {message}")
113-
.run()
114-
.expect("FAILED to commit rust-toolchain file, something went wrong");
121+
cmd!(
122+
sh,
123+
"git commit --no-verify -m {message} -- {TOOLCHAIN_TOML} {UTILS_README}"
124+
)
125+
.run()
126+
.expect("FAILED to commit rust-toolchain.toml file, something went wrong");
115127

116128
let commit = rustc_hash();
117129

0 commit comments

Comments
 (0)