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

Address cargo fmt and clippy issues #11

Merged
merged 2 commits into from
Nov 9, 2023
Merged
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
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
Loading