Skip to content

Commit

Permalink
Merge pull request #1 from uklotzde/refacto-client-api
Browse files Browse the repository at this point in the history
Merge main and fix issues
  • Loading branch information
creberust committed Mar 11, 2024
2 parents 164082d + 6d2c31c commit 84d419e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ jobs:
shared-key: ${{ github.workflow }}-${{ github.job }}

- name: Detect code style issues (push)
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1
if: github.event_name == 'push'

- name: Detect code style issues (pull_request)
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1
if: github.event_name == 'pull_request'
env:
SKIP: no-commit-to-branch
17 changes: 15 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
rev: v9.12.0
hooks:
- id: commitlint
stages:
Expand All @@ -44,7 +44,7 @@ repos:
- id: codespell
args: [--ignore-words=.codespellignore]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.27.3
rev: 0.28.0
hooks:
- id: check-github-actions
- id: check-github-workflows
Expand All @@ -66,6 +66,7 @@ repos:
- id: fmt
args: [--all, --]
- id: clippy
name: clippy --all-features
args:
[
--locked,
Expand All @@ -76,6 +77,18 @@ repos:
-D,
warnings,
]
- id: clippy
name: clippy --no-default-features
args:
[
--locked,
--workspace,
--no-default-features,
--all-targets,
--,
-D,
warnings,
]
- repo: local
hooks:
- id: cargo-doc
Expand Down
12 changes: 7 additions & 5 deletions src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ pub(crate) mod rtu;
#[cfg(feature = "tcp")]
pub(crate) mod tcp;

use std::io;

/// Check that `req_hdr` is the same `Header` as `rsp_hdr`.
///
/// # Errors
///
/// If the 2 headers are different, an [`io::Error`] will be returned with [`io::ErrorKind::InvalidData`].
fn verify_response_header<H: Eq + std::fmt::Debug>(req_hdr: &H, rsp_hdr: &H) -> io::Result<()> {
#[cfg(any(feature = "rtu", feature = "tcp"))]
fn verify_response_header<H: Eq + std::fmt::Debug>(
req_hdr: &H,
rsp_hdr: &H,
) -> std::io::Result<()> {
if req_hdr != rsp_hdr {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidData,
format!(
"Invalid response header: expected/request = {req_hdr:?}, actual/response = {rsp_hdr:?}"
),
Expand Down

0 comments on commit 84d419e

Please sign in to comment.