Skip to content

Commit

Permalink
Fix new clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
robamler committed Jan 28, 2023
1 parent 23d1622 commit 3a447ba
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ impl<BackendError: Display, FrontendError: Display> Display
{
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Frontend(err) => write!(f, "Invalid compressed data: {}", err),
Self::Backend(err) => write!(f, "Error while reading compressed data: {}", err),
Self::Frontend(err) => write!(f, "Invalid compressed data: {err}"),
Self::Backend(err) => write!(f, "Error while reading compressed data: {err}"),
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/pybindings/stream/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ impl ChainCoder {
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) or
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel) model class.
#[pyo3(text_signature = "(DEPRECATED)")]
pub fn encode_iid_custom_model_reverse<'py>(
pub fn encode_iid_custom_model_reverse(
&mut self,
py: Python<'py>,
py: Python<'_>,
symbols: PyReadonlyArray1<'_, i32>,
model: &Model,
) -> PyResult<()> {
Expand All @@ -293,9 +293,9 @@ impl ChainCoder {
/// entropy model).
#[pyo3(text_signature = "(model, optional_amt_or_model_params)")]
#[args(symbols, model, params = "*")]
pub fn decode<'py>(
pub fn decode(
&mut self,
py: Python<'py>,
py: Python<'_>,
model: &Model,
params: &PyTuple,
) -> PyResult<PyObject> {
Expand Down Expand Up @@ -434,9 +434,9 @@ impl ChainCoder {
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) or
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel) model class.
#[pyo3(text_signature = "(DEPRECATED)")]
pub fn decode_iid_custom_model<'py>(
pub fn decode_iid_custom_model(
&mut self,
py: Python<'py>,
py: Python<'_>,
amt: usize,
model: &Model,
) -> PyResult<PyObject> {
Expand Down
4 changes: 2 additions & 2 deletions src/pybindings/stream/model/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ impl Model for UnspecializedPythonModel {
(callback)(&self.quantizer.quantize(distribution))
}

fn parameterize<'py>(
fn parameterize(
&self,
py: Python<'py>,
py: Python<'_>,
params: &PyTuple,
reverse: bool,
callback: &mut dyn FnMut(&dyn DefaultEntropyModel) -> PyResult<()>,
Expand Down
12 changes: 6 additions & 6 deletions src/pybindings/stream/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,9 @@ impl RangeEncoder {
/// print(encoder.get_compressed()) # (prints: [1204741195, 2891990943])
/// ```
#[pyo3(text_signature = "(DEPRECATED)")]
pub fn encode_iid_custom_model<'py>(
pub fn encode_iid_custom_model(
&mut self,
py: Python<'py>,
py: Python<'_>,
symbols: PyReadonlyArray1<'_, i32>,
model: &Model,
) -> PyResult<()> {
Expand Down Expand Up @@ -899,9 +899,9 @@ impl RangeDecoder {
/// ```
#[pyo3(text_signature = "(model, optional_amt_or_model_params)")]
#[args(symbols, model, params = "*")]
pub fn decode<'py>(
pub fn decode(
&mut self,
py: Python<'py>,
py: Python<'_>,
model: &Model,
params: &PyTuple,
) -> PyResult<PyObject> {
Expand Down Expand Up @@ -978,9 +978,9 @@ impl RangeDecoder {
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) and
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel).
#[pyo3(text_signature = "(DEPRECATED)")]
pub fn decode_iid_custom_model<'py>(
pub fn decode_iid_custom_model(
&mut self,
py: Python<'py>,
py: Python<'_>,
amt: usize,
model: &Model,
) -> PyResult<PyObject> {
Expand Down
12 changes: 6 additions & 6 deletions src/pybindings/stream/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,9 @@ impl AnsCoder {
/// print(coder.get_compressed()) # (prints: [609762275, 3776398430])
/// ```
#[pyo3(text_signature = "(DEPRECATED)")]
pub fn encode_iid_custom_model_reverse<'py>(
pub fn encode_iid_custom_model_reverse(
&mut self,
py: Python<'py>,
py: Python<'_>,
symbols: PyReadonlyArray1<'_, i32>,
model: &Model,
) -> PyResult<()> {
Expand Down Expand Up @@ -835,9 +835,9 @@ impl AnsCoder {
/// ```
#[pyo3(text_signature = "(model, optional_amt_or_model_params)")]
#[args(symbols, model, params = "*")]
pub fn decode<'py>(
pub fn decode(
&mut self,
py: Python<'py>,
py: Python<'_>,
model: &Model,
params: &PyTuple,
) -> PyResult<PyObject> {
Expand Down Expand Up @@ -1076,9 +1076,9 @@ impl AnsCoder {
/// [`CustomModel`](model.html#constriction.stream.model.CustomModel) and
/// [`ScipyModel`](model.html#constriction.stream.model.ScipyModel).
#[pyo3(text_signature = "(DEPRECATED)")]
pub fn decode_iid_custom_model<'py>(
pub fn decode_iid_custom_model(
&mut self,
py: Python<'py>,
py: Python<'_>,
amt: usize,
model: &Model,
) -> PyResult<PyObject> {
Expand Down
16 changes: 4 additions & 12 deletions src/stream/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,10 @@ impl<CompressedBackendError: Display, RemaindersBackendError: Display> core::fmt
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Compressed(err) => {
write!(f, "Read/write error when accessing compressed: {}", err)
write!(f, "Read/write error when accessing compressed: {err}")
}
Self::Remainders(err) => {
write!(f, "Read/write error when accessing remainders: {}", err)
write!(f, "Read/write error when accessing remainders: {err}")
}
}
}
Expand Down Expand Up @@ -884,18 +884,10 @@ where
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
ChangePrecisionError::Increase(err) => {
write!(
f,
"Error while increasing precision of chain coder: {}",
err
)
write!(f, "Error while increasing precision of chain coder: {err}")
}
ChangePrecisionError::Decrease(err) => {
write!(
f,
"Error while decreasing precision of chain coder: {}",
err
)
write!(f, "Error while decreasing precision of chain coder: {err}")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,10 +1330,10 @@ impl<CodingError: Display, ModelError: Display> Display
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InvalidEntropyModel(err) => {
write!(f, "Error while constructing entropy model or data: {}", err)
write!(f, "Error while constructing entropy model or data: {err}")
}
Self::CodingError(err) => {
write!(f, "Error while entropy coding: {}", err)
write!(f, "Error while entropy coding: {err}")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/symbol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ impl<InvalidCodeword: Display> Display for SymbolCodeError<InvalidCodeword> {
f,
"The compressed data ended before the current codeword was complete."
),
Self::InvalidCodeword(err) => write!(f, "Invalid codeword for this codebook: {}", err),
Self::InvalidCodeword(err) => write!(f, "Invalid codeword for this codebook: {err}"),
}
}
}
Expand Down

0 comments on commit 3a447ba

Please sign in to comment.