Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cargo fmt #563

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,21 @@ jobs:
- name: Deploy textwrap-wasm-demo-app
if: steps.git-add.outputs.has-changes == 'true'
run: git push origin

format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

# We use an unstable rustfmt feature and we thus need the
# nightly channel to enforce the formatting.
- name: Setup Rust nightly
run: rustup default nightly

- name: Install rustfmt
run: rustup component add rustfmt

- name: Check Formatting
uses: dprint/[email protected]
19 changes: 19 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"markdown": {
"textWrap": "always"
},
"exec": {
"commands": [{
"command": "rustfmt",
"exts": ["rs"]
}]
},
"excludes": ["target/"],
"plugins": [
"https://plugins.dprint.dev/json-0.17.4.wasm",
"https://plugins.dprint.dev/markdown-0.16.1.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm",
"https://plugins.dprint.dev/exec-0.4.3.json@42343548b8022c99b1d750be6b894fe6b6c7ee25f72ae9f9082226dd2e515072",
"https://plugins.dprint.dev/prettier-0.27.0.json@3557a62b4507c55a47d8cde0683195b14d13c41dda66d0f0b0e111aed107e2fe"
]
}
5 changes: 1 addition & 4 deletions src/wrap_algorithms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,7 @@ impl Default for WrapAlgorithm {
///
/// Apologies to anyone who actually knows how to build a house and
/// knows how long each step takes :-)
pub fn wrap_first_fit<'a, T: Fragment>(
fragments: &'a [T],
line_widths: &[f64],
) -> Vec<&'a [T]> {
pub fn wrap_first_fit<'a, T: Fragment>(fragments: &'a [T], line_widths: &[f64]) -> Vec<&'a [T]> {
// The final line width is used for all remaining lines.
let default_line_width = line_widths.last().copied().unwrap_or(0.0);
let mut lines = Vec::new();
Expand Down
Loading