Skip to content

Commit a969ef3

Browse files
committed
Fix new clippy lints
1 parent 23d1622 commit a969ef3

9 files changed

Lines changed: 34 additions & 42 deletions

File tree

benches/lookup.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ where
8787
type_name::<Probability>(),
8888
PRECISION
8989
);
90-
c.bench_function(&format!("ans_encoding_{}", label_suffix), |b| {
90+
c.bench_function(&format!("ans_encoding_{label_suffix}"), |b| {
9191
b.iter(|| {
9292
encoder.clear();
9393
encoder
@@ -109,7 +109,7 @@ where
109109
let mut backward_decoder = encoder.into_seekable_decoder();
110110
let reset_snapshot = backward_decoder.pos();
111111

112-
c.bench_function(&format!("ans_backward_decoding_{}", label_suffix), |b| {
112+
c.bench_function(&format!("ans_backward_decoding_{label_suffix}"), |b| {
113113
b.iter(|| {
114114
backward_decoder.seek(black_box(reset_snapshot)).unwrap();
115115
let mut checksum = 1234u16;
@@ -132,7 +132,7 @@ where
132132
let mut forward_decoder = backward_decoder.into_reversed();
133133
let reset_snapshot = forward_decoder.pos();
134134

135-
c.bench_function(&format!("ans_forward_decoding_{}", label_suffix), |b| {
135+
c.bench_function(&format!("ans_forward_decoding_{label_suffix}"), |b| {
136136
b.iter(|| {
137137
forward_decoder.seek(black_box(reset_snapshot)).unwrap();
138138
let mut checksum = 1234u16;
@@ -179,7 +179,7 @@ where
179179
type_name::<Probability>(),
180180
PRECISION
181181
);
182-
c.bench_function(&format!("range_encoding_{}", label_suffix), |b| {
182+
c.bench_function(&format!("range_encoding_{label_suffix}"), |b| {
183183
b.iter(|| {
184184
encoder.clear();
185185
encoder
@@ -200,7 +200,7 @@ where
200200

201201
let mut decoder = encoder.into_decoder().unwrap();
202202

203-
c.bench_function(&format!("range_decoding_{}", label_suffix), |b| {
203+
c.bench_function(&format!("range_decoding_{label_suffix}"), |b| {
204204
b.iter(|| {
205205
decoder.seek(black_box(reset_snapshot)).unwrap();
206206
let mut checksum = 1234u16;

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ impl<BackendError: Display, FrontendError: Display> Display
336336
{
337337
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
338338
match self {
339-
Self::Frontend(err) => write!(f, "Invalid compressed data: {}", err),
340-
Self::Backend(err) => write!(f, "Error while reading compressed data: {}", err),
339+
Self::Frontend(err) => write!(f, "Invalid compressed data: {err}"),
340+
Self::Backend(err) => write!(f, "Error while reading compressed data: {err}"),
341341
}
342342
}
343343
}

src/pybindings/stream/chain.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ impl ChainCoder {
265265
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) or
266266
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel) model class.
267267
#[pyo3(text_signature = "(DEPRECATED)")]
268-
pub fn encode_iid_custom_model_reverse<'py>(
268+
pub fn encode_iid_custom_model_reverse(
269269
&mut self,
270-
py: Python<'py>,
270+
py: Python<'_>,
271271
symbols: PyReadonlyArray1<'_, i32>,
272272
model: &Model,
273273
) -> PyResult<()> {
@@ -293,9 +293,9 @@ impl ChainCoder {
293293
/// entropy model).
294294
#[pyo3(text_signature = "(model, optional_amt_or_model_params)")]
295295
#[args(symbols, model, params = "*")]
296-
pub fn decode<'py>(
296+
pub fn decode(
297297
&mut self,
298-
py: Python<'py>,
298+
py: Python<'_>,
299299
model: &Model,
300300
params: &PyTuple,
301301
) -> PyResult<PyObject> {
@@ -434,9 +434,9 @@ impl ChainCoder {
434434
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) or
435435
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel) model class.
436436
#[pyo3(text_signature = "(DEPRECATED)")]
437-
pub fn decode_iid_custom_model<'py>(
437+
pub fn decode_iid_custom_model(
438438
&mut self,
439-
py: Python<'py>,
439+
py: Python<'_>,
440440
amt: usize,
441441
model: &Model,
442442
) -> PyResult<PyObject> {

src/pybindings/stream/model/internals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ impl Model for UnspecializedPythonModel {
258258
(callback)(&self.quantizer.quantize(distribution))
259259
}
260260

261-
fn parameterize<'py>(
261+
fn parameterize(
262262
&self,
263-
py: Python<'py>,
263+
py: Python<'_>,
264264
params: &PyTuple,
265265
reverse: bool,
266266
callback: &mut dyn FnMut(&dyn DefaultEntropyModel) -> PyResult<()>,

src/pybindings/stream/queue.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@ impl RangeEncoder {
535535
/// print(encoder.get_compressed()) # (prints: [1204741195, 2891990943])
536536
/// ```
537537
#[pyo3(text_signature = "(DEPRECATED)")]
538-
pub fn encode_iid_custom_model<'py>(
538+
pub fn encode_iid_custom_model(
539539
&mut self,
540-
py: Python<'py>,
540+
py: Python<'_>,
541541
symbols: PyReadonlyArray1<'_, i32>,
542542
model: &Model,
543543
) -> PyResult<()> {
@@ -899,9 +899,9 @@ impl RangeDecoder {
899899
/// ```
900900
#[pyo3(text_signature = "(model, optional_amt_or_model_params)")]
901901
#[args(symbols, model, params = "*")]
902-
pub fn decode<'py>(
902+
pub fn decode(
903903
&mut self,
904-
py: Python<'py>,
904+
py: Python<'_>,
905905
model: &Model,
906906
params: &PyTuple,
907907
) -> PyResult<PyObject> {
@@ -978,9 +978,9 @@ impl RangeDecoder {
978978
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) and
979979
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel).
980980
#[pyo3(text_signature = "(DEPRECATED)")]
981-
pub fn decode_iid_custom_model<'py>(
981+
pub fn decode_iid_custom_model(
982982
&mut self,
983-
py: Python<'py>,
983+
py: Python<'_>,
984984
amt: usize,
985985
model: &Model,
986986
) -> PyResult<PyObject> {

src/pybindings/stream/stack.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,9 @@ impl AnsCoder {
721721
/// print(coder.get_compressed()) # (prints: [609762275, 3776398430])
722722
/// ```
723723
#[pyo3(text_signature = "(DEPRECATED)")]
724-
pub fn encode_iid_custom_model_reverse<'py>(
724+
pub fn encode_iid_custom_model_reverse(
725725
&mut self,
726-
py: Python<'py>,
726+
py: Python<'_>,
727727
symbols: PyReadonlyArray1<'_, i32>,
728728
model: &Model,
729729
) -> PyResult<()> {
@@ -835,9 +835,9 @@ impl AnsCoder {
835835
/// ```
836836
#[pyo3(text_signature = "(model, optional_amt_or_model_params)")]
837837
#[args(symbols, model, params = "*")]
838-
pub fn decode<'py>(
838+
pub fn decode(
839839
&mut self,
840-
py: Python<'py>,
840+
py: Python<'_>,
841841
model: &Model,
842842
params: &PyTuple,
843843
) -> PyResult<PyObject> {
@@ -1076,9 +1076,9 @@ impl AnsCoder {
10761076
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) and
10771077
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel).
10781078
#[pyo3(text_signature = "(DEPRECATED)")]
1079-
pub fn decode_iid_custom_model<'py>(
1079+
pub fn decode_iid_custom_model(
10801080
&mut self,
1081-
py: Python<'py>,
1081+
py: Python<'_>,
10821082
amt: usize,
10831083
model: &Model,
10841084
) -> PyResult<PyObject> {

src/stream/chain.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -841,10 +841,10 @@ impl<CompressedBackendError: Display, RemaindersBackendError: Display> core::fmt
841841
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
842842
match self {
843843
Self::Compressed(err) => {
844-
write!(f, "Read/write error when accessing compressed: {}", err)
844+
write!(f, "Read/write error when accessing compressed: {err}")
845845
}
846846
Self::Remainders(err) => {
847-
write!(f, "Read/write error when accessing remainders: {}", err)
847+
write!(f, "Read/write error when accessing remainders: {err}")
848848
}
849849
}
850850
}
@@ -884,18 +884,10 @@ where
884884
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
885885
match self {
886886
ChangePrecisionError::Increase(err) => {
887-
write!(
888-
f,
889-
"Error while increasing precision of chain coder: {}",
890-
err
891-
)
887+
write!(f, "Error while increasing precision of chain coder: {err}")
892888
}
893889
ChangePrecisionError::Decrease(err) => {
894-
write!(
895-
f,
896-
"Error while decreasing precision of chain coder: {}",
897-
err
898-
)
890+
write!(f, "Error while decreasing precision of chain coder: {err}")
899891
}
900892
}
901893
}

src/stream/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,10 +1330,10 @@ impl<CodingError: Display, ModelError: Display> Display
13301330
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13311331
match self {
13321332
Self::InvalidEntropyModel(err) => {
1333-
write!(f, "Error while constructing entropy model or data: {}", err)
1333+
write!(f, "Error while constructing entropy model or data: {err}")
13341334
}
13351335
Self::CodingError(err) => {
1336-
write!(f, "Error while entropy coding: {}", err)
1336+
write!(f, "Error while entropy coding: {err}")
13371337
}
13381338
}
13391339
}

src/symbol/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ impl<InvalidCodeword: Display> Display for SymbolCodeError<InvalidCodeword> {
698698
f,
699699
"The compressed data ended before the current codeword was complete."
700700
),
701-
Self::InvalidCodeword(err) => write!(f, "Invalid codeword for this codebook: {}", err),
701+
Self::InvalidCodeword(err) => write!(f, "Invalid codeword for this codebook: {err}"),
702702
}
703703
}
704704
}

0 commit comments

Comments
 (0)