Skip to content

Commit

Permalink
Merge pull request #11 from flatcar/dongsu/fmt-clippy
Browse files Browse the repository at this point in the history
Address cargo fmt and clippy issues
  • Loading branch information
dongsupark authored Nov 9, 2023
2 parents de1e0d8 + 3dfee64 commit b1c8362
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
43 changes: 29 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
name: Rust
name: Run Rust CI

on:
push:
branches: [ flatcar-master ]
branches:
- flatcar-master
pull_request:
branches: [ flatcar-master ]

env:
CARGO_TERM_COLOR: always
branches:
- flatcar-master

jobs:
build:

build-test:
name: Build and test update-ssh-keys
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- name: Rustfmt Check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --check
- name: Build update-ssh-keys
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose
- name: Run unit tests of update-ssh-keys
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl AuthorizedKeys {

// destroy the old authorized keys file and move the staging one to that
// location
fs::rename(&stage_filename, &self.authorized_keys_file()).chain_err(|| {
fs::rename(&stage_filename, self.authorized_keys_file()).chain_err(|| {
format!(
"failed to move '{:?}' to '{:?}'",
stage_filename,
Expand Down Expand Up @@ -381,7 +381,7 @@ impl AuthorizedKeys {
/// files
fn read_all_keys(dir: &Path) -> Result<HashMap<String, AuthorizedKeySet>> {
let dir_contents =
fs::read_dir(&dir).chain_err(|| format!("failed to read from directory {:?}", dir))?;
fs::read_dir(dir).chain_err(|| format!("failed to read from directory {:?}", dir))?;
let mut keys = HashMap::new();
for entry in dir_contents {
let entry =
Expand Down

0 comments on commit b1c8362

Please sign in to comment.