Skip to content

Commit

Permalink
Create rust.yml (#10)
Browse files Browse the repository at this point in the history
* Create rust.yml

* Fix linter issues.
  • Loading branch information
cryptoquick authored Mar 2, 2023
1 parent 5e9a732 commit 055673b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Check Formatting
run: cargo fmt --all -- --check

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- uses: olix0r/cargo-action-fmt/setup@v2
- name: Lint
run: cargo clippy --lib --all-features --message-format=json -- -D warnings | cargo-action-fmt
2 changes: 2 additions & 0 deletions src/backend/fs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused_variables)]

use std::{fs::OpenOptions, io::Write, path::PathBuf};

use anyhow::{anyhow, Result};
Expand Down
8 changes: 4 additions & 4 deletions src/structs.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::str::FromStr;
use std::{fmt, str::FromStr};

use anyhow::Error;

pub struct Blake3Hash(pub blake3::Hash);

impl Blake3Hash {
pub fn to_string(&self) -> String {
impl fmt::Display for Blake3Hash {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let Self(hash) = self;

hash.to_string()
f.write_str(&hash.to_string())
}
}

Expand Down

0 comments on commit 055673b

Please sign in to comment.