Introduce a "cargo fmt" github action gate
This should prevent non-fmt code from hitting the master branch.
This commit is contained in:
parent
ffe73cd0da
commit
8d7b92b1b1
2 changed files with 39 additions and 8 deletions
26
.github/workflows/rust-checks.yml
vendored
Normal file
26
.github/workflows/rust-checks.yml
vendored
Normal 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
|
||||||
21
src/main.rs
21
src/main.rs
|
|
@ -1526,11 +1526,13 @@ impl App {
|
||||||
Some(colors) => {
|
Some(colors) => {
|
||||||
let current_pane = self.pane_model.focused();
|
let current_pane = self.pane_model.focused();
|
||||||
if let Some(tab_model) = self.pane_model.active_mut() {
|
if let Some(tab_model) = self.pane_model.active_mut() {
|
||||||
let (options, tab_title_override) = if let Some(profile) = profile_id_opt
|
let (options, tab_title_override) = if let Some(profile) =
|
||||||
.and_then(|profile_id| self.config.profiles.get(&profile_id))
|
profile_id_opt
|
||||||
|
.and_then(|profile_id| self.config.profiles.get(&profile_id))
|
||||||
{
|
{
|
||||||
// Merge profile and startup options, preferring startup options
|
// 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 {
|
let options = tty::Options {
|
||||||
shell: startup_options.shell.or_else(|| {
|
shell: startup_options.shell.or_else(|| {
|
||||||
if let Some(mut args) = shlex::split(&profile.command) {
|
if let Some(mut args) = shlex::split(&profile.command) {
|
||||||
|
|
@ -1541,11 +1543,14 @@ impl App {
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
}),
|
}),
|
||||||
working_directory: startup_options.working_directory.or_else(|| {
|
working_directory: startup_options.working_directory.or_else(
|
||||||
(!profile.working_directory.is_empty())
|
|| {
|
||||||
.then(|| profile.working_directory.clone().into())
|
(!profile.working_directory.is_empty())
|
||||||
}),
|
.then(|| profile.working_directory.clone().into())
|
||||||
drain_on_exit: startup_options.drain_on_exit || profile.drain_on_exit,
|
},
|
||||||
|
),
|
||||||
|
drain_on_exit: startup_options.drain_on_exit
|
||||||
|
|| profile.drain_on_exit,
|
||||||
..startup_options
|
..startup_options
|
||||||
};
|
};
|
||||||
let tab_title_override = if profile.tab_title.is_empty() {
|
let tab_title_override = if profile.tab_title.is_empty() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue