Introduce a "cargo fmt" github action gate

This should prevent non-fmt code from hitting the master branch.
This commit is contained in:
Chris Glass 2026-02-28 22:39:27 +01:00
parent ffe73cd0da
commit 8d7b92b1b1
2 changed files with 39 additions and 8 deletions

26
.github/workflows/rust-checks.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: Rust Checks
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check

View file

@ -1526,11 +1526,13 @@ impl App {
Some(colors) => {
let current_pane = self.pane_model.focused();
if let Some(tab_model) = self.pane_model.active_mut() {
let (options, tab_title_override) = if let Some(profile) = profile_id_opt
.and_then(|profile_id| self.config.profiles.get(&profile_id))
let (options, tab_title_override) = if let Some(profile) =
profile_id_opt
.and_then(|profile_id| self.config.profiles.get(&profile_id))
{
// Merge profile and startup options, preferring startup options
let startup_options = self.startup_options.take().unwrap_or_default();
let startup_options =
self.startup_options.take().unwrap_or_default();
let options = tty::Options {
shell: startup_options.shell.or_else(|| {
if let Some(mut args) = shlex::split(&profile.command) {
@ -1541,11 +1543,14 @@ impl App {
}
return None;
}),
working_directory: startup_options.working_directory.or_else(|| {
(!profile.working_directory.is_empty())
.then(|| profile.working_directory.clone().into())
}),
drain_on_exit: startup_options.drain_on_exit || profile.drain_on_exit,
working_directory: startup_options.working_directory.or_else(
|| {
(!profile.working_directory.is_empty())
.then(|| profile.working_directory.clone().into())
},
),
drain_on_exit: startup_options.drain_on_exit
|| profile.drain_on_exit,
..startup_options
};
let tab_title_override = if profile.tab_title.is_empty() {