Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Fix Clippy errors #9

Closed
josecelano opened this issue Sep 25, 2023 · 0 comments · Fixed by #10
Closed

Fix Clippy errors #9

josecelano opened this issue Sep 25, 2023 · 0 comments · Fixed by #10
Assignees

Comments

@josecelano
Copy link
Member

    Checking torrust-serde-bencode v0.2.3 (/home/josecelano/Documents/git/committer/me/github/torrust/torrust-serde-bencode)
error: variables can be used directly in the `format!` string
   --> src/de.rs:122:42
    |
122 |               t => Err(Error::InvalidValue(format!(
    |  __________________________________________^
123 | |                 "Expected bytes or map; got `{:?}`",
124 | |                 t
125 | |             ))),
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
    = note: `-D clippy::uninlined-format-args` implied by `-D clippy::pedantic`
    = help: to override `-D clippy::pedantic` add `#[allow(clippy::uninlined_format_args)]`

error: variables can be used directly in the `format!` string
   --> src/de.rs:149:40
    |
149 |             Self::End => Error::custom(format_args!("unexpected end, expected {}", expected)),
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
149 -             Self::End => Error::custom(format_args!("unexpected end, expected {}", expected)),
149 +             Self::End => Error::custom(format_args!("unexpected end, expected {expected}")),
    |

error: this lifetime isn't used in the impl
   --> src/de.rs:161:6
    |
161 | impl<'de, R: Read> Deserializer<R> {
    |      ^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
    = note: `-D clippy::extra-unused-lifetimes` implied by `-D clippy::complexity`
    = help: to override `-D clippy::complexity` add `#[allow(clippy::extra_unused_lifetimes)]`

error: variables can be used directly in the `format!` string
   --> src/de.rs:180:45
    |
180 |                         Error::InvalidValue(format!("Can't parse `{}` as integer", len_str))
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
180 -                         Error::InvalidValue(format!("Can't parse `{}` as integer", len_str))
180 +                         Error::InvalidValue(format!("Can't parse `{len_str}` as integer"))
    |

error: variables can be used directly in the `format!` string
   --> src/de.rs:203:45
    |
203 |                         Error::InvalidValue(format!("Can't parse `{}` as string length", len_str))
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
203 -                         Error::InvalidValue(format!("Can't parse `{}` as string length", len_str))
203 +                         Error::InvalidValue(format!("Can't parse `{len_str}` as string length"))
    |

error: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/de.rs:262:71
    |
262 |             ParseResult::List => visitor.visit_seq(BencodeAccess::new(&mut self, None)),
    |                                                                       ^^^^^^^^^ help: change this to: `self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `-D clippy::needless-borrow` implied by `-D clippy::style`
    = help: to override `-D clippy::style` add `#[allow(clippy::needless_borrow)]`

error: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/de.rs:263:70
    |
263 |             ParseResult::Map => visitor.visit_map(BencodeAccess::new(&mut self, None)),
    |                                                                      ^^^^^^^^^ help: change this to: `self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

error: this match arm has an identical body to another arm
   --> src/error.rs:110:13
    |
110 |             Error::InvalidType(ref s) => s,
    |             -------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidType(ref s) | Error::InvalidValue(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:111:13
    |
111 |             Error::InvalidValue(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
    = note: `-D clippy::match-same-arms` implied by `-D clippy::pedantic`
    = help: to override `-D clippy::pedantic` add `#[allow(clippy::match_same_arms)]`

error: this match arm has an identical body to another arm
   --> src/error.rs:110:13
    |
110 |             Error::InvalidType(ref s) => s,
    |             -------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidType(ref s) | Error::InvalidLength(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:112:13
    |
112 |             Error::InvalidLength(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:111:13
    |
111 |             Error::InvalidValue(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidValue(ref s) | Error::InvalidLength(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:112:13
    |
112 |             Error::InvalidLength(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:110:13
    |
110 |             Error::InvalidType(ref s) => s,
    |             -------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidType(ref s) | Error::UnknownVariant(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:113:13
    |
113 |             Error::UnknownVariant(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:111:13
    |
111 |             Error::InvalidValue(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidValue(ref s) | Error::UnknownVariant(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:113:13
    |
113 |             Error::UnknownVariant(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:112:13
    |
112 |             Error::InvalidLength(ref s) => s,
    |             ---------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidLength(ref s) | Error::UnknownVariant(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:113:13
    |
113 |             Error::UnknownVariant(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:110:13
    |
110 |             Error::InvalidType(ref s) => s,
    |             -------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidType(ref s) | Error::UnknownField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:114:13
    |
114 |             Error::UnknownField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:111:13
    |
111 |             Error::InvalidValue(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidValue(ref s) | Error::UnknownField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:114:13
    |
114 |             Error::UnknownField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:112:13
    |
112 |             Error::InvalidLength(ref s) => s,
    |             ---------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidLength(ref s) | Error::UnknownField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:114:13
    |
114 |             Error::UnknownField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:113:13
    |
113 |             Error::UnknownVariant(ref s) => s,
    |             ----------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::UnknownVariant(ref s) | Error::UnknownField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:114:13
    |
114 |             Error::UnknownField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:110:13
    |
110 |             Error::InvalidType(ref s) => s,
    |             -------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidType(ref s) | Error::MissingField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:115:13
    |
115 |             Error::MissingField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:111:13
    |
111 |             Error::InvalidValue(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidValue(ref s) | Error::MissingField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:115:13
    |
115 |             Error::MissingField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:112:13
    |
112 |             Error::InvalidLength(ref s) => s,
    |             ---------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidLength(ref s) | Error::MissingField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:115:13
    |
115 |             Error::MissingField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:113:13
    |
113 |             Error::UnknownVariant(ref s) => s,
    |             ----------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::UnknownVariant(ref s) | Error::MissingField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:115:13
    |
115 |             Error::MissingField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:114:13
    |
114 |             Error::UnknownField(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::UnknownField(ref s) | Error::MissingField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:115:13
    |
115 |             Error::MissingField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:110:13
    |
110 |             Error::InvalidType(ref s) => s,
    |             -------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidType(ref s) | Error::DuplicateField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:116:13
    |
116 |             Error::DuplicateField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:111:13
    |
111 |             Error::InvalidValue(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidValue(ref s) | Error::DuplicateField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:116:13
    |
116 |             Error::DuplicateField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:112:13
    |
112 |             Error::InvalidLength(ref s) => s,
    |             ---------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidLength(ref s) | Error::DuplicateField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:116:13
    |
116 |             Error::DuplicateField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:113:13
    |
113 |             Error::UnknownVariant(ref s) => s,
    |             ----------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::UnknownVariant(ref s) | Error::DuplicateField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:116:13
    |
116 |             Error::DuplicateField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:114:13
    |
114 |             Error::UnknownField(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::UnknownField(ref s) | Error::DuplicateField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:116:13
    |
116 |             Error::DuplicateField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:115:13
    |
115 |             Error::MissingField(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::MissingField(ref s) | Error::DuplicateField(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:116:13
    |
116 |             Error::DuplicateField(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:110:13
    |
110 |             Error::InvalidType(ref s) => s,
    |             -------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidType(ref s) | Error::Custom(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:117:13
    |
117 |             Error::Custom(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:111:13
    |
111 |             Error::InvalidValue(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidValue(ref s) | Error::Custom(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:117:13
    |
117 |             Error::Custom(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:112:13
    |
112 |             Error::InvalidLength(ref s) => s,
    |             ---------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::InvalidLength(ref s) | Error::Custom(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:117:13
    |
117 |             Error::Custom(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:113:13
    |
113 |             Error::UnknownVariant(ref s) => s,
    |             ----------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::UnknownVariant(ref s) | Error::Custom(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:117:13
    |
117 |             Error::Custom(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:114:13
    |
114 |             Error::UnknownField(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::UnknownField(ref s) | Error::Custom(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:117:13
    |
117 |             Error::Custom(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:115:13
    |
115 |             Error::MissingField(ref s) => s,
    |             --------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::MissingField(ref s) | Error::Custom(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:117:13
    |
117 |             Error::Custom(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: this match arm has an identical body to another arm
   --> src/error.rs:116:13
    |
116 |             Error::DuplicateField(ref s) => s,
    |             ----------------------------^^^^^
    |             |
    |             help: try merging the arm patterns: `Error::DuplicateField(ref s) | Error::Custom(ref s)`
    |
    = help: or try changing either arm body
note: other arm here
   --> src/error.rs:117:13
    |
117 |             Error::Custom(ref s) => s,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

error: item name starts with its containing module's name
  --> src/ser/string.rs:25:12
   |
25 | pub struct StringSerializer;
   |            ^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
   = note: `-D clippy::module-name-repetitions` implied by `-D clippy::pedantic`
   = help: to override `-D clippy::pedantic` add `#[allow(clippy::module_name_repetitions)]`

error: casting `i8` to `i64` may become silently lossy if you later change the type
  --> src/ser/string.rs:42:28
   |
42 |         self.serialize_i64(value as i64)
   |                            ^^^^^^^^^^^^ help: try: `i64::from(value)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
   = note: `-D clippy::cast-lossless` implied by `-D clippy::pedantic`
   = help: to override `-D clippy::pedantic` add `#[allow(clippy::cast_lossless)]`

error: casting `i16` to `i64` may become silently lossy if you later change the type
  --> src/ser/string.rs:45:28
   |
45 |         self.serialize_i64(value as i64)
   |                            ^^^^^^^^^^^^ help: try: `i64::from(value)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `i32` to `i64` may become silently lossy if you later change the type
  --> src/ser/string.rs:48:28
   |
48 |         self.serialize_i64(value as i64)
   |                            ^^^^^^^^^^^^ help: try: `i64::from(value)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `u8` to `u64` may become silently lossy if you later change the type
  --> src/ser/string.rs:54:28
   |
54 |         self.serialize_u64(value as u64)
   |                            ^^^^^^^^^^^^ help: try: `u64::from(value)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `u16` to `u64` may become silently lossy if you later change the type
  --> src/ser/string.rs:57:28
   |
57 |         self.serialize_u64(value as u64)
   |                            ^^^^^^^^^^^^ help: try: `u64::from(value)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `u32` to `u64` may become silently lossy if you later change the type
  --> src/ser/string.rs:60:28
   |
60 |         self.serialize_u64(value as u64)
   |                            ^^^^^^^^^^^^ help: try: `u64::from(value)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `f32` to `f64` may become silently lossy if you later change the type
  --> src/ser/string.rs:66:28
   |
66 |         self.serialize_f64(value as f64)
   |                            ^^^^^^^^^^^^ help: try: `f64::from(value)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: this method could have a `#[must_use]` attribute
  --> src/ser.rs:18:5
   |
18 |     pub fn new() -> Serializer {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn new() -> Serializer`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
   = note: `-D clippy::must-use-candidate` implied by `-D clippy::pedantic`
   = help: to override `-D clippy::pedantic` add `#[allow(clippy::must_use_candidate)]`

error: this method could have a `#[must_use]` attribute
  --> src/ser.rs:23:5
   |
23 |     pub fn into_vec(self) -> Vec<u8> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn into_vec(self) -> Vec<u8>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate

error: dereferencing a tuple pattern where every element takes a reference
   --> src/ser.rs:108:26
    |
108 |         entries.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b));
    |                          ^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
    = note: `-D clippy::needless-borrowed-reference` implied by `-D clippy::complexity`
    = help: to override `-D clippy::complexity` add `#[allow(clippy::needless_borrowed_reference)]`
help: try removing the `&` and `ref` parts
    |
108 -         entries.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b));
108 +         entries.sort_by(|(a, _), &(ref b, _)| a.cmp(b));
    |

error: dereferencing a tuple pattern where every element takes a reference
   --> src/ser.rs:108:39
    |
108 |         entries.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b));
    |                                       ^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
help: try removing the `&` and `ref` parts
    |
108 -         entries.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b));
108 +         entries.sort_by(|&(ref a, _), (b, _)| a.cmp(b));
    |

error: casting `bool` to `i64` is more cleanly stated with `i64::from(_)`
   --> src/ser.rs:215:28
    |
215 |         self.serialize_i64(value as i64)
    |                            ^^^^^^^^^^^^ help: try: `i64::from(value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `i8` to `i64` may become silently lossy if you later change the type
   --> src/ser.rs:218:28
    |
218 |         self.serialize_i64(value as i64)
    |                            ^^^^^^^^^^^^ help: try: `i64::from(value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `i16` to `i64` may become silently lossy if you later change the type
   --> src/ser.rs:221:28
    |
221 |         self.serialize_i64(value as i64)
    |                            ^^^^^^^^^^^^ help: try: `i64::from(value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `i32` to `i64` may become silently lossy if you later change the type
   --> src/ser.rs:224:28
    |
224 |         self.serialize_i64(value as i64)
    |                            ^^^^^^^^^^^^ help: try: `i64::from(value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `u8` to `u64` may become silently lossy if you later change the type
   --> src/ser.rs:233:28
    |
233 |         self.serialize_u64(value as u64)
    |                            ^^^^^^^^^^^^ help: try: `u64::from(value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `u16` to `u64` may become silently lossy if you later change the type
   --> src/ser.rs:236:28
    |
236 |         self.serialize_u64(value as u64)
    |                            ^^^^^^^^^^^^ help: try: `u64::from(value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: casting `u32` to `u64` may become silently lossy if you later change the type
   --> src/ser.rs:239:28
    |
239 |         self.serialize_u64(value as u64)
    |                            ^^^^^^^^^^^^ help: try: `u64::from(value)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

error: redundant closure
   --> src/ser.rs:419:14
    |
419 |         .map(|s| s.to_string())
    |              ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
    = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D clippy::pedantic`
    = help: to override `-D clippy::pedantic` add `#[allow(clippy::redundant_closure_for_method_calls)]`

error: casting `u64` to `i64` may wrap around the value
  --> src/value.rs:68:23
   |
68 |         Ok(Value::Int(value as i64))
   |                       ^^^^^^^^^^^^
   |
   = note: `-D clippy::cast-possible-wrap` implied by `-D clippy::pedantic`
   = help: to override `-D clippy::pedantic` add `#[allow(clippy::cast_possible_wrap)]`

error: could not compile `torrust-serde-bencode` (lib test) due to 56 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `torrust-serde-bencode` (lib) due to 56 previous errors
@josecelano josecelano self-assigned this Sep 25, 2023
josecelano added a commit to josecelano/torrust-serde-bencode that referenced this issue Sep 25, 2023
Some of them were allow:

- #[allow(clippy::extra_unused_lifetimes)]
- #[allow(clippy::cast_possible_wrap)]
- #[allow(clippy::needless_pass_by_value)]

Pending to review.
@josecelano josecelano linked a pull request Sep 25, 2023 that will close this issue
josecelano added a commit to josecelano/torrust-serde-bencode that referenced this issue Sep 25, 2023
Some of them were allow:

- #[allow(clippy::extra_unused_lifetimes)]
- #[allow(clippy::cast_possible_wrap)]
- #[allow(clippy::needless_pass_by_value)]

Pending to review.
josecelano added a commit to josecelano/torrust-serde-bencode that referenced this issue Sep 25, 2023
Some of them were allow:

- #[allow(clippy::extra_unused_lifetimes)]
- #[allow(clippy::cast_possible_wrap)]
- #[allow(clippy::needless_pass_by_value)]

Pending to review.
josecelano added a commit to josecelano/torrust-serde-bencode that referenced this issue Sep 25, 2023
Some of them were allow:

- #[allow(clippy::extra_unused_lifetimes)]
- #[allow(clippy::cast_possible_wrap)]
- #[allow(clippy::needless_pass_by_value)]

Pending to review.
josecelano added a commit to josecelano/torrust-serde-bencode that referenced this issue Sep 25, 2023
Some of them were allow:

- #[allow(clippy::extra_unused_lifetimes)]
- #[allow(clippy::cast_possible_wrap)]
- #[allow(clippy::needless_pass_by_value)]

Pending to review.
josecelano added a commit that referenced this issue Sep 25, 2023
b3b2a44 fix: [#9] Clipply errors (Jose Celano)

Pull request description:

  Some of them were allow:

  - #[allow(clippy::extra_unused_lifetimes)]
  - #[allow(clippy::cast_possible_wrap)]
  - #[allow(clippy::needless_pass_by_value)]

  Pending to review.

Top commit has no ACKs.

Tree-SHA512: 65cfae5a9bc119b04ebca25b847024bc17ec727f9290f11dd855bcf104990177cf46d596263babfdaba7e4f86967170cb759580fe0382ddb7bc5a9e799a87268
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant