diff --git a/.editorconfig b/.editorconfig index 10f6dda..2a0d6c5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,11 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = false + +[*.yml] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c07022d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +name: Rust + +on: + push: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + rust: [stable, nightly] + + name: ${{ matrix.rust }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + components: rustfmt, clippy + + - name: cargo build + uses: actions-rs/cargo@v1 + with: + command: build + + - name: cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml index 213f0a7..5414411 100644 --- a/.github/workflows/fmt.yml +++ b/.github/workflows/fmt.yml @@ -19,10 +19,21 @@ jobs: git config --global user.name "MedzikUserBot" git config --global user.email "rm99iv9s@duck.com" - - name: Lint - run: cargo fmt + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy - - name: Push changes + - name: cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all + + - name: Commit changes run: | git add . git diff-index --quiet HEAD || git commit -m "rustfmt" diff --git a/Cargo.lock b/Cargo.lock index 6278914..39c236c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "anyhow" -version = "1.0.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" - [[package]] name = "atty" version = "0.2.14" @@ -377,7 +371,6 @@ dependencies = [ name = "imgurs" version = "0.1.0" dependencies = [ - "anyhow", "base64", "chrono", "clap", @@ -387,7 +380,6 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "shadow", "simple_logger", "tokio", "toml", @@ -853,15 +845,6 @@ dependencies = [ "serde", ] -[[package]] -name = "shadow" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcaa1dbf13cc052b53af59e70dd467e8e94d6abf8d0eac1f1d15d3e165973b86" -dependencies = [ - "libc", -] - [[package]] name = "signal-hook-registry" version = "1.4.0" diff --git a/Cargo.toml b/Cargo.toml index 1b31988..824e26c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,11 +7,10 @@ edition = "2021" dirs = "4.0.0" serde = "1.0.134" serde_derive = "1.0.134" -shadow = "0.0.1" toml = "0.5.8" serde_json = "1.0.75" chrono = "0.4.19" -anyhow = "1.0.53" +#anyhow = "1.0.53" base64 = "0.13.0" [dependencies.clap] diff --git a/src/api/configuration.rs b/src/api/configuration.rs index 3588e94..0514f60 100644 --- a/src/api/configuration.rs +++ b/src/api/configuration.rs @@ -24,8 +24,8 @@ impl ImgurHandle { pub fn new(client_id: String) -> Self { let client = Client::new(); ImgurHandle { - client_id: client_id, - client: client, + client_id, + client, } } }