add cargo fmt to lint staged (#56430)

Keep forgetting to run `cargo fmt` before committing

Closes WEB-1707
This commit is contained in:
Leah 2023-10-04 19:46:44 +02:00 committed by GitHub
parent 338f80b4fd
commit 00aea747c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,6 +27,12 @@ module.exports = {
`git add ${escapedFileNames}`,
]
},
'**/*.rs': (filenames) => {
const escapedFileNames = filenames
.map((filename) => (isWin ? filename : escape([filename])))
.join(' ')
return [`cargo fmt -- ${escapedFileNames}`, `git add ${escapedFileNames}`]
},
}
function escape(str) {