Skip to content

Commit ee960c5

Browse files
bors[bot]eldruin
andauthored
Merge #31
31: Several updates r=ryankurte a=eldruin - Update dependencies - Update MSRV due to dependencies - Add common traits to public structures - Small warning fixes - Several fixes to the CI - Update README badge Co-authored-by: Diego Barrios Romero <[email protected]>
2 parents cbbec45 + dd6db08 commit ee960c5

File tree

8 files changed

+26
-31
lines changed

8 files changed

+26
-31
lines changed

.github/bors.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ block_labels = ["needs-decision"]
22
delete_merged_branches = true
33
required_approvals = 1
44
status = [
5-
"ci-linux (stable, x86_64-unknown-linux-gnu)",
6-
"ci-linux (stable, x86_64-unknown-linux-musl)",
7-
"ci-linux (beta, x86_64-unknown-linux-gnu)",
8-
"ci-linux (beta, x86_64-unknown-linux-musl)",
9-
"ci-linux (1.40.0, x86_64-unknown-linux-gnu)",
10-
"ci-linux (1.40.0, x86_64-unknown-linux-musl)",
5+
"CI (stable, x86_64-unknown-linux-gnu)",
6+
"CI (stable, x86_64-unknown-linux-musl)",
7+
"CI (beta, x86_64-unknown-linux-gnu)",
8+
"CI (beta, x86_64-unknown-linux-musl)",
9+
"CI (1.46.0, x86_64-unknown-linux-gnu)",
10+
"CI (1.46.0, x86_64-unknown-linux-musl)",
1111
]

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ name: Continuous integration
77

88
jobs:
99
ci-linux:
10+
name: CI
1011
runs-on: ubuntu-latest
1112
continue-on-error: ${{ matrix.experimental || false }}
1213
strategy:
1314
matrix:
1415
# All published crates must build on stable.
15-
rust: [stable, beta, 1.40.0]
16+
rust: [stable, beta, 1.46.0]
1617

1718
# The default target we're compiling on and for.
1819
TARGET: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl]

.github/workflows/clippy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions-rs/toolchain@v1
1313
with:
1414
profile: minimal
15-
toolchain: stable
15+
toolchain: 1.55.0
1616
override: true
1717
components: clippy
1818
- uses: actions-rs/clippy-check@v1

CHANGELOG.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
## Not yet released
44

5-
- Nix bumped to 0.20
6-
- Minimum supported rust version is now 1.40.0
5+
[Full Changelog](https://github.com/rust-embedded/rust-spidev/compare/0.4.1...HEAD)
6+
7+
- Added `Debug` implementation for `Spidev`
8+
- Added `Debug`, `Default`, `Copy` and `PartialEq` implementations for `SpidevOptions`
9+
- Nix bumped to 0.22
10+
- bitflags updated to 1.3
11+
- Minimum supported rust version is now 1.46.0
712

813
## 0.4.1 / 2021-02-21
914

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ half-duplex SPI access, and full-duplex SPI access.
1717

1818
[dependencies]
1919
libc = "0.2"
20-
bitflags = "1.0"
21-
nix = "0.20"
20+
bitflags = "1.3"
21+
nix = "0.22"

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Rust Spidev
22

3-
[![Build Status](https://travis-ci.org/rust-embedded/rust-spidev.svg?branch=master)](https://travis-ci.org/rust-embedded/rust-spidev)
3+
[![Build Status](https://github.com/rust-embedded/rust-spidev/workflows/CI/badge.svg)](https://github.com/rust-embedded/rust-spidev/actions)
44
[![Version](https://img.shields.io/crates/v/spidev.svg)](https://crates.io/crates/spidev)
55
[![License](https://img.shields.io/crates/l/spidev.svg)](https://github.com/rust-embedded/rust-spidev/blob/master/README.md#license)
66

@@ -76,7 +76,7 @@ The following features are implemented and planned for the library:
7676

7777
## Minimum Supported Rust Version (MSRV)
7878

79-
This crate is guaranteed to compile on stable Rust 1.40 and up. It *might*
79+
This crate is guaranteed to compile on stable Rust 1.46 and up. It *might*
8080
compile with older versions but that may change in any new patch release.
8181

8282
## Cross Compiling

src/lib.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ bitflags! {
115115
}
116116

117117
/// Provide high-level access to Linux Spidev Driver
118+
#[derive(Debug)]
118119
pub struct Spidev {
119120
devfile: File,
120121
}
@@ -128,7 +129,7 @@ pub struct Spidev {
128129
/// Options that are not configured with one of the builder
129130
/// functions will not be modified in the kernel when
130131
/// `configure` is called.
131-
#[derive(Clone)]
132+
#[derive(Debug, Default, Clone, Copy, PartialEq)]
132133
pub struct SpidevOptions {
133134
pub bits_per_word: Option<u8>,
134135
pub max_speed_hz: Option<u32>,
@@ -139,12 +140,7 @@ pub struct SpidevOptions {
139140
impl SpidevOptions {
140141
/// Create a new, empty set of options
141142
pub fn new() -> SpidevOptions {
142-
SpidevOptions {
143-
bits_per_word: None,
144-
max_speed_hz: None,
145-
lsb_first: None,
146-
spi_mode: None,
147-
}
143+
SpidevOptions::default()
148144
}
149145

150146
/// The number of bits in each SPI transfer word
@@ -193,7 +189,7 @@ impl SpidevOptions {
193189

194190
/// Finalize and build the SpidevOptions
195191
pub fn build(&self) -> Self {
196-
self.clone()
192+
*self
197193
}
198194
}
199195

src/spidevioctl.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,10 @@ use std::io;
1313
use std::marker::PhantomData;
1414
use std::os::unix::prelude::*;
1515

16-
fn from_nix_error(err: ::nix::Error) -> io::Error {
17-
io::Error::from_raw_os_error(
18-
err.as_errno()
19-
.unwrap_or_else(|| nix::errno::Errno::UnknownErrno) as i32,
20-
)
21-
}
22-
2316
fn from_nix_result<T>(res: ::nix::Result<T>) -> io::Result<T> {
2417
match res {
2518
Ok(r) => Ok(r),
26-
Err(err) => Err(from_nix_error(err)),
19+
Err(err) => Err(err.into()),
2720
}
2821
}
2922

@@ -116,7 +109,7 @@ impl<'a, 'b> spi_ioc_transfer<'a, 'b> {
116109
mod ioctl {
117110
use super::*;
118111

119-
const SPI_IOC_MAGIC: u8 = 'k' as u8;
112+
const SPI_IOC_MAGIC: u8 = b'k';
120113
const SPI_IOC_NR_TRANSFER: u8 = 0;
121114
const SPI_IOC_NR_MODE: u8 = 1;
122115
const SPI_IOC_NR_LSB_FIRST: u8 = 2;

0 commit comments

Comments
 (0)