Skip to content

Commit

Permalink
Merge pull request #50 from epage/template
Browse files Browse the repository at this point in the history
chore: Update from _rust template
  • Loading branch information
epage authored Sep 27, 2024
2 parents 7d10c38 + 779540e commit 8d76200
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- bans licenses sources
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check ${{ matrix.checks }}
rust-version: stable
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ We ask that commits are atomic, meaning they are complete and have a single resp
PRs should tell a cohesive story, with test and refactor commits that keep the
fix or feature commits simple and clear.

Specifically, we would encouage
Specifically, we would encourage
- File renames be isolated into their own commit
- Add tests in a commit before their feature or fix, showing the current behavior.
The diff for the feature/fix commit will then show how the behavior changed,
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ string_lit_as_bytes = "warn"
string_to_string = "warn"
todo = "warn"
trait_duplication_in_bounds = "warn"
uninlined_format_args = "warn"
verbose_file_reads = "warn"
wildcard_imports = "warn"
zero_sized_map_values = "warn"
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Line {
) -> Result<(), std::io::Error> {
match self {
Self::Control { name, args } => {
write!(out, ".{}", name)?;
write!(out, ".{name}")?;
for arg in args {
write!(out, " {}", &escape_spaces(arg))?;
}
Expand All @@ -267,9 +267,9 @@ impl Line {
};
let text = escape_leading_cc(&text);
if let Inline::Bold(_) = inline {
write!(out, r"\fB{}\fR", text)?;
write!(out, r"\fB{text}\fR")?;
} else if let Inline::Italic(_) = inline {
write!(out, r"\fI{}\fR", text)?;
write!(out, r"\fI{text}\fR")?;
} else {
if at_line_start && starts_with_cc(&text) {
// Line would start with a period, so we
Expand All @@ -285,7 +285,7 @@ impl Line {
// line.
write!(out, r"\&").unwrap();
}
write!(out, "{}", text)?;
write!(out, "{text}")?;
}
}
}
Expand All @@ -307,7 +307,7 @@ fn starts_with_cc(line: &str) -> bool {
/// quotes in any way: there doesn't seem to a way to escape them.
fn escape_spaces(w: &str) -> String {
if w.contains(' ') {
format!("\"{}\"", w)
format!("\"{w}\"")
} else {
w.to_owned()
}
Expand Down
6 changes: 2 additions & 4 deletions tests/testsuite/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ pub(crate) fn has_command(command: &str) -> bool {
// CI is expected to support all of the commands
if is_ci() && cfg!(target_os = "linux") {
panic!(
"expected command `{}` to be somewhere in PATH: {}",
command, e
"expected command `{command}` to be somewhere in PATH: {e}"
);
}
return false;
Expand All @@ -99,8 +98,7 @@ pub(crate) fn has_command(command: &str) -> bool {
let stdout = String::from_utf8_lossy(&output.stdout);
println!(
"$ {command} --version
{}",
stdout
{stdout}"
);
if cfg!(target_os = "macos") && stdout.starts_with("GNU bash, version 3") {
return false;
Expand Down

0 comments on commit 8d76200

Please sign in to comment.