Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2c78de

Browse files
authored
solve remaining clippy warnings and add it to CI (#487)
1 parent306e909 commitc2c78de

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

‎.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ jobs:
5353
fi
5454
if: matrix.build == 'stable'
5555
56-
rustfmt:
57-
name:Rustfmt &Docs
56+
rustfmt_docs_clippy:
57+
name:Rustfmt,Docs and Clippy
5858
runs-on:ubuntu-latest
5959
steps:
6060
-uses:actions/checkout@v4
6161
-name:Install Rust
62-
run:rustup update stable && rustup default stable && rustup component add rustfmt
62+
run:rustup update stable && rustup default stable && rustup component add rustfmt && rustup component add clippy
6363
-run:cargo fmt -- --check
6464
-run:cargo doc --all-features
65+
-run:cargo clippy --all-features -- -D warnings
6566

6667
wasm:
6768
name:WebAssembly

‎src/ffi/c.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ impl InflateBackend for Inflate {
287287
MZ_OK =>Ok(Status::Ok),
288288
MZ_BUF_ERROR =>Ok(Status::BufError),
289289
MZ_STREAM_END =>Ok(Status::StreamEnd),
290+
#[allow(clippy::unnecessary_cast)]
290291
MZ_NEED_DICT => mem::decompress_need_dict((*raw).adlerasu32),
291292
c =>panic!("unknown return code: {}", c),
292293
}
@@ -465,11 +466,11 @@ mod c_backend {
465466
pubconstMZ_DEFAULT_WINDOW_BITS:c_int =15;
466467

467468
#[cfg(feature ="zlib-ng")]
468-
constZLIB_VERSION:&'staticstr ="2.1.0.devel\0";
469+
constZLIB_VERSION:&str ="2.1.0.devel\0";
469470
#[cfg(all(not(feature ="zlib-ng"), feature ="zlib-rs"))]
470-
constZLIB_VERSION:&'staticstr ="1.3.0-zlib-rs-0.5.0\0";
471+
constZLIB_VERSION:&str ="1.3.0-zlib-rs-0.5.0\0";
471472
#[cfg(not(any(feature ="zlib-ng", feature ="zlib-rs")))]
472-
constZLIB_VERSION:&'staticstr ="1.2.8\0";
473+
constZLIB_VERSION:&str ="1.2.8\0";
473474

474475
pubunsafeextern"C"fnmz_deflateInit2(
475476
stream:*mutmz_stream,

‎src/gz/bufread.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<R: BufRead> GzEncoder<R> {
8686
calced_crc_bytes[1],
8787
calced_crc_bytes[2],
8888
calced_crc_bytes[3],
89-
(crc.amount() >>0)asu8,
89+
crc.amount()asu8,
9090
(crc.amount() >>8)asu8,
9191
(crc.amount() >>16)asu8,
9292
(crc.amount() >>24)asu8,
@@ -117,11 +117,11 @@ impl<R> GzEncoder<R> {
117117

118118
#[inline]
119119
fnfinish(buf:&[u8;8]) ->(u32,u32){
120-
let crc =((buf[0]asu32) <<0)
120+
let crc =(buf[0]asu32)
121121
|((buf[1]asu32) <<8)
122122
|((buf[2]asu32) <<16)
123123
|((buf[3]asu32) <<24);
124-
let amt =((buf[4]asu32) <<0)
124+
let amt =(buf[4]asu32)
125125
|((buf[5]asu32) <<8)
126126
|((buf[6]asu32) <<16)
127127
|((buf[7]asu32) <<24);

‎src/gz/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl GzHeaderParser {
135135
ifself.flags&FRESERVED !=0{
136136
returnErr(bad_header());
137137
}
138-
self.header.mtime =((buffer[4]asu32) <<0)
138+
self.header.mtime =(buffer[4]asu32)
139139
|((buffer[5]asu32) <<8)
140140
|((buffer[6]asu32) <<16)
141141
|((buffer[7]asu32) <<24);
@@ -417,7 +417,7 @@ impl GzBuilder {
417417
header[1] =0x8b;
418418
header[2] =8;
419419
header[3] = flg;
420-
header[4] =(mtime >>0)asu8;
420+
header[4] = mtimeasu8;
421421
header[5] =(mtime >>8)asu8;
422422
header[6] =(mtime >>16)asu8;
423423
header[7] =(mtime >>24)asu8;

‎src/gz/write.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ impl<W: Write> GzEncoder<W> {
9393
whileself.crc_bytes_written <8{
9494
let(sum, amt) =(self.crc.sum(),self.crc.amount());
9595
let buf =[
96-
(sum >>0)asu8,
96+
sumasu8,
9797
(sum >>8)asu8,
9898
(sum >>16)asu8,
9999
(sum >>24)asu8,
100-
(amt >>0)asu8,
100+
amtasu8,
101101
(amt >>8)asu8,
102102
(amt >>16)asu8,
103103
(amt >>24)asu8,
@@ -294,11 +294,11 @@ impl<W: Write> GzDecoder<W> {
294294
returnErr(corrupt());
295295
}
296296

297-
let crc =((self.crc_bytes[0]asu32) <<0)
297+
let crc =(self.crc_bytes[0]asu32)
298298
|((self.crc_bytes[1]asu32) <<8)
299299
|((self.crc_bytes[2]asu32) <<16)
300300
|((self.crc_bytes[3]asu32) <<24);
301-
let amt =((self.crc_bytes[4]asu32) <<0)
301+
let amt =(self.crc_bytes[4]asu32)
302302
|((self.crc_bytes[5]asu32) <<8)
303303
|((self.crc_bytes[6]asu32) <<16)
304304
|((self.crc_bytes[7]asu32) <<24);

‎src/mem.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub struct Decompress {
4343
/// in-memory data.
4444
#[derive(Copy,Clone,PartialEq,Eq,Debug)]
4545
#[non_exhaustive]
46+
#[allow(clippy::unnecessary_cast)]
4647
pubenumFlushCompress{
4748
/// A typical parameter for passing to compression/decompression functions,
4849
/// this indicates that the underlying stream to decide how much data to
@@ -86,6 +87,7 @@ pub enum FlushCompress {
8687
/// decompressing in-memory data.
8788
#[derive(Copy,Clone,PartialEq,Eq,Debug)]
8889
#[non_exhaustive]
90+
#[allow(clippy::unnecessary_cast)]
8991
pubenumFlushDecompress{
9092
/// A typical parameter for passing to compression/decompression functions,
9193
/// this indicates that the underlying stream to decide how much data to
@@ -277,6 +279,7 @@ impl Compress {
277279

278280
match rc{
279281
ffi::MZ_STREAM_ERROR =>compress_failed(self.inner.inner.msg()),
282+
#[allow(clippy::unnecessary_cast)]
280283
ffi::MZ_OK =>Ok(unsafe{(*stream).adler}asu32),
281284
c =>panic!("unknown return code: {}", c),
282285
}
@@ -493,6 +496,7 @@ impl Decompress {
493496
ffi::inflateSetDictionary(stream, dictionary.as_ptr(), dictionary.len()as ffi::uInt)
494497
};
495498

499+
#[allow(clippy::unnecessary_cast)]
496500
match rc{
497501
ffi::MZ_STREAM_ERROR =>decompress_failed(self.inner.inner.msg()),
498502
ffi::MZ_DATA_ERROR =>decompress_need_dict(unsafe{(*stream).adler}asu32),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp