Skip to content

Commit

Permalink
feat: fix clippy error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfdl committed Jun 17, 2024
1 parent 092ea39 commit f4c48b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 32 deletions.
49 changes: 27 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,42 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache cargo registry
- name: Cache cargo
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
${{ runner.os }}-cargo-
- name: Install Rust toolchain and components
run: |
rustup update --no-self-update stable
rustup component add --toolchain stable rustfmt clippy
rustup default stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy

- name: Create .env file
run: |
echo "SERVER_SSL_CA=${{ secrets.SERVER_SSL_CA }}" >> .env
echo "SERVER_SSL_CERT=${{ secrets.SERVER_SSL_CERT }}" >> .env
echo "SERVER_SSL_KEY=${{ secrets.SERVER_SSL_KEY }}" >> .env
- name: Build and Test
run: |
cargo build --verbose
cargo test --verbose
cargo clippy -- -D warnings
cargo fmt -- --check
- name: Build
run: cargo build --verbose

- name: Test
run: cargo test --verbose

- name: Lint
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

- name: Format Check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
9 changes: 0 additions & 9 deletions src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub struct RelayConfig {
pub id: String,
pub config: ConfigFile,
pub profile_id: Option<String>,
pub state: Option<InitiatedState>,
}

#[derive(serde::Serialize, serde::Deserialize, Default, Debug, Clone)]
Expand Down Expand Up @@ -35,13 +34,11 @@ impl RelayConfig {
// Ensure that profile_id and state are not None
let id = "self-hosted".to_string();
let profile_id = Some(profile_id.unwrap_or_else(|| "self-hosted".to_string()));
let state: Option<InitiatedState> = Some(InitiatedState::Stopped);

Ok(RelayConfig {
id,
config: config.with_defaults()?,
profile_id,
state,
})
}

Expand Down Expand Up @@ -83,12 +80,6 @@ impl Mqtt {
}
}

#[derive(Debug, Clone, serde::Deserialize)]
pub enum InitiatedState {
Stopped,
Running,
}

#[derive(serde::Deserialize)]
pub struct PublishRequest {
pub topic: String,
Expand Down
1 change: 0 additions & 1 deletion src/services/tagoio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ mod tests {
},
},
profile_id: None,
state: None,
}
}

Expand Down

0 comments on commit f4c48b2

Please sign in to comment.