Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 5c6e1d0

Browse files
authored
update deps + loosen some requirements (#12)
* update deps + loosen some requirements rules: - for crates that are below v1.0 -> specify the precise version - If the code uses a feature that was added for example in X 0.3.17, then you should specify 0.3.17, which actually means "0.3.y where y >= 17" - for crates the are above or equal v1.0 -> specify only major version if the crate's API is minimal and won't change between minor versions OR specify major&minor versions otherwise tested with https://github.com/taiki-e/cargo-minimal-versions * fix warnings
1 parent 7d0d1fb commit 5c6e1d0

File tree

27 files changed

+99
-63
lines changed

27 files changed

+99
-63
lines changed

.github/workflows/cargo.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,76 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
build:
14-
name: Build and test
13+
check_and_test:
14+
name: Check and test
1515
strategy:
1616
matrix:
1717
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
18+
toolchain:
19+
- 1.56.1 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
20+
- stable
1821
runs-on: ${{ matrix.os }}
1922
steps:
20-
- uses: actions/checkout@v2
21-
- name: Build
22-
run: cargo build --verbose
23-
- name: Run tests
24-
run: cargo test --verbose
23+
- uses: actions/checkout@v3
24+
- name: Cache cargo registry
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cargo/registry
28+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
29+
- uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: ${{ matrix.toolchain }}
32+
profile: minimal
33+
override: true
34+
- uses: actions-rs/cargo@v1
35+
with:
36+
command: check
37+
- uses: actions-rs/cargo@v1
38+
with:
39+
command: test
2540

2641
rustfmt_and_clippy:
27-
name: Check rustfmt style && run clippy
42+
name: Check rustfmt style and run clippy
2843
runs-on: ubuntu-latest
2944
steps:
30-
- uses: actions/checkout@v2
45+
- uses: actions/checkout@v3
3146
- uses: actions-rs/toolchain@v1
3247
with:
33-
toolchain: 1.55.0
48+
toolchain: stable
3449
profile: minimal
3550
components: clippy, rustfmt
3651
override: true
3752
- name: Cache cargo registry
38-
uses: actions/cache@v1
53+
uses: actions/cache@v3
3954
with:
4055
path: ~/.cargo/registry
4156
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
4257
- name: Run clippy
4358
uses: actions-rs/cargo@v1
4459
with:
4560
command: clippy
61+
args: -- -D warnings
4662
- name: Check formating
4763
uses: actions-rs/cargo@v1
4864
with:
4965
command: fmt
5066
args: --all -- --check
67+
68+
minimal_versions:
69+
name: Compile and test with minimal versions
70+
strategy:
71+
matrix:
72+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
73+
runs-on: ${{ matrix.os }}
74+
steps:
75+
- uses: actions/checkout@v3
76+
- name: Install latest nightly
77+
uses: actions-rs/toolchain@v1
78+
with:
79+
toolchain: nightly
80+
override: true
81+
- uses: taiki-e/install-action@cargo-hack
82+
- uses: taiki-e/install-action@cargo-minimal-versions
83+
- run: cargo minimal-versions check --workspace --all-features --ignore-private -v
84+
- run: cargo minimal-versions build --workspace --all-features --ignore-private -v
85+
- run: cargo minimal-versions test --workspace --all-features -v

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ homepage = "https://webrtc.rs"
1010
repository = "https://github.com/webrtc-rs/rtcp"
1111

1212
[dependencies]
13-
util = { package = "webrtc-util", version = "0.5.3", default-features = false, features = ["marshal"] }
14-
bytes = "1.1.0"
15-
thiserror = "1.0.30"
13+
util = { package = "webrtc-util", version = "0.5.4", default-features = false, features = ["marshal"] }
14+
bytes = "1"
15+
thiserror = "1.0"
1616

1717
[dev-dependencies]
18-
tokio = { version = "1.15.0", features = ["sync"] }
19-
tokio-test = "0.4.2"
18+
tokio = { version = "1.19", features = ["sync"] }
19+
tokio-test = "0.4.0" # must match the min version of the `tokio` crate above

src/compound_packet/compound_packet_test.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ fn test_bad_compound() {
7575
compound_len, 2
7676
);
7777

78-
if let None = compound.0[0].as_any().downcast_ref::<Goodbye>() {
78+
if compound.0[0].as_any().downcast_ref::<Goodbye>().is_none() {
7979
panic!("Unmarshal(badcompound), want Goodbye")
8080
}
8181

82-
if let None = compound.0[1]
82+
if compound.0[1]
8383
.as_any()
8484
.downcast_ref::<PictureLossIndication>()
85+
.is_none()
8586
{
8687
panic!("Unmarshal(badcompound), want PictureLossIndication")
8788
}
@@ -311,7 +312,7 @@ fn test_compound_packet_roundtrip() {
311312
name, got, err
312313
);
313314
} else {
314-
assert!(false, "want error in test {}", name);
315+
panic!("want error in test {}", name);
315316
}
316317
continue;
317318
} else {

src/extended_report/dlrr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::*;
33
const DLRR_REPORT_LENGTH: u16 = 12;
44

55
/// DLRRReport encodes a single report inside a DLRRReportBlock.
6-
#[derive(Debug, Default, PartialEq, Clone)]
6+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
77
pub struct DLRRReport {
88
pub ssrc: u32,
99
pub last_rr: u32,
@@ -34,7 +34,7 @@ impl fmt::Display for DLRRReport {
3434
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block
3535
/// : ... : 2
3636
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
37-
#[derive(Debug, Default, PartialEq, Clone)]
37+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
3838
pub struct DLRRReportBlock {
3939
pub reports: Vec<DLRRReport>,
4040
}

src/extended_report/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const XR_HEADER_LENGTH: usize = 4;
3232

3333
/// BlockType specifies the type of report in a report block
3434
/// Extended Report block types from RFC 3611.
35-
#[derive(Debug, Copy, Clone, PartialEq)]
35+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
3636
pub enum BlockType {
3737
Unknown = 0,
3838
LossRLE = 1, // RFC 3611, section 4.1
@@ -93,7 +93,7 @@ pub type TypeSpecificField = u8;
9393
/// shouldn't need to access this. For locally-constructed report
9494
/// blocks, these values will not be accurate until the corresponding
9595
/// packet is marshaled.
96-
#[derive(Debug, Default, PartialEq, Clone)]
96+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
9797
pub struct XRHeader {
9898
pub block_type: BlockType,
9999
pub type_specific: TypeSpecificField,

src/extended_report/prt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const PRT_REPORT_BLOCK_MIN_LENGTH: u16 = 8;
2222
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2323
/// | Receipt time of packet (end_seq - 1) mod 65536 |
2424
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25-
#[derive(Debug, Default, PartialEq, Clone)]
25+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
2626
pub struct PacketReceiptTimesReportBlock {
2727
//not included in marshal/unmarshal
2828
pub t: u8,

src/extended_report/rle.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::*;
33
const RLE_REPORT_BLOCK_MIN_LENGTH: u16 = 8;
44

55
/// ChunkType enumerates the three kinds of chunks described in RFC 3611 section 4.1.
6-
#[derive(Debug, Copy, Clone, PartialEq)]
6+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
77
pub enum ChunkType {
88
RunLength = 0,
99
BitVector = 1,
@@ -36,7 +36,7 @@ pub enum ChunkType {
3636
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3737
/// |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|
3838
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39-
#[derive(Debug, Default, PartialEq, Clone)]
39+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
4040
pub struct Chunk(pub u16);
4141

4242
impl fmt::Display for Chunk {
@@ -102,7 +102,7 @@ impl Chunk {
102102
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
103103
/// | chunk n-1 | chunk n |
104104
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
105-
#[derive(Debug, Default, PartialEq, Clone)]
105+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
106106
pub struct RLEReportBlock {
107107
//not included in marshal/unmarshal
108108
pub is_loss_rle: bool,

src/extended_report/rrt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const RRT_REPORT_BLOCK_LENGTH: u16 = 8;
1414
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1515
/// | NTP timestamp, least significant word |
1616
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
17-
#[derive(Debug, Default, PartialEq, Clone)]
17+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
1818
pub struct ReceiverReferenceTimeReportBlock {
1919
pub ntp_timestamp: u64,
2020
}

src/extended_report/ssr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const SSR_REPORT_BLOCK_LENGTH: u16 = 4 + 2 * 2 + 4 * 6 + 4;
2828
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2929
/// | min_ttl_or_hl | max_ttl_or_hl |mean_ttl_or_hl | dev_ttl_or_hl |
3030
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31-
#[derive(Debug, Default, PartialEq, Clone)]
31+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
3232
pub struct StatisticsSummaryReportBlock {
3333
//not included in marshal/unmarshal
3434
pub loss_reports: bool,
@@ -60,7 +60,7 @@ impl fmt::Display for StatisticsSummaryReportBlock {
6060

6161
/// TTLorHopLimitType encodes values for the ToH field in
6262
/// a StatisticsSummaryReportBlock
63-
#[derive(Debug, Copy, Clone, PartialEq)]
63+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
6464
pub enum TTLorHopLimitType {
6565
Missing = 0,
6666
IPv4 = 1,

src/extended_report/unknown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::*;
22

33
/// UnknownReportBlock is used to store bytes for any report block
44
/// that has an unknown Report Block Type.
5-
#[derive(Debug, Default, PartialEq, Clone)]
5+
#[derive(Debug, Default, PartialEq, Eq, Clone)]
66
pub struct UnknownReportBlock {
77
pub bytes: Bytes,
88
}

0 commit comments

Comments
 (0)