Skip to content

Instantly share code, notes, and snippets.

@wthrajat

wthrajat/log.md Secret

Created January 23, 2024 18:23
Show Gist options
  • Save wthrajat/b9a347dfd3a5fefa18ffb6c9b958b029 to your computer and use it in GitHub Desktop.
Save wthrajat/b9a347dfd3a5fefa18ffb6c9b958b029 to your computer and use it in GitHub Desktop.
tonlib-rs
warning: operator precedence can trip the unwary
   --> src/cell/raw.rs:265:30
    |
265 |         let l = last_byte | (1 << 8 - padding_bits - 1);
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (8 - padding_bits - 1)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
    = note: `#[warn(clippy::precedence)]` on by default

warning: operator precedence can trip the unwary
   --> src/cell.rs:128:34
    |
128 |             let l = last_byte | (1 << 8 - rest_bits - 1);
    |                                  ^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (8 - rest_bits - 1)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence

warning: redundant field names in struct initialization
   --> src/client/connection.rs:162:13
    |
162 |             id: id,
    |             ^^^^^^ help: replace it with: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
    = note: `#[warn(clippy::redundant_field_names)]` on by default

warning: redundant field names in struct initialization
   --> src/client/interface.rs:189:46
    |
189 |         let func = TonFunction::SmcGetCode { id: id };
    |                                              ^^^^^^ help: replace it with: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/client/interface.rs:201:46
    |
201 |         let func = TonFunction::SmcGetData { id: id };
    |                                              ^^^^^^ help: replace it with: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/client/interface.rs:213:47
    |
213 |         let func = TonFunction::SmcGetState { id: id };
    |                                               ^^^^^^ help: replace it with: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/tl.rs:38:17
   |
38 |                 ptr: ptr,
   |                 ^^^^^^^^ help: replace it with: `ptr`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: using `clone` on type `[u8; 32]` which implements the `Copy` trait
  --> src/address.rs:33:24
   |
33 |             hash_part: hash_part.clone(),
   |                        ^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*hash_part`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
   = note: `#[warn(clippy::clone_on_copy)]` on by default

warning: single-character string constant used as pattern
  --> src/address.rs:42:40
   |
42 |         let parts: Vec<&str> = s.split(":").collect();
   |                                        ^^^ help: try using a `char` instead: `':'`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
   = note: `#[warn(clippy::single_char_pattern)]` on by default

warning: this call to `from_str_radix` can be replaced with a call to `str::parse`
  --> src/address.rs:51:24
   |
51 |         let maybe_wc = i32::from_str_radix(parts[0], 10);
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `parts[0].parse::<i32>()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_str_radix_10
   = note: `#[warn(clippy::from_str_radix_10)]` on by default

warning: casting integer literal to `u8` is unnecessary
   --> src/address.rs:199:30
    |
199 |         let mut hash_part = [0 as u8; 32];
    |                              ^^^^^^^ help: try: `0_u8`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
    = note: `#[warn(clippy::unnecessary_cast)]` on by default

warning: the borrowed expression implements the required traits
   --> src/address.rs:219:31
    |
219 |         base64::encode_config(&buf, base64::URL_SAFE_NO_PAD)
    |                               ^^^^ help: change this to: `buf`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default

warning: the borrowed expression implements the required traits
   --> src/address.rs:229:31
    |
229 |         base64::encode_config(&buf, base64::STANDARD_NO_PAD)
    |                               ^^^^ help: change this to: `buf`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/cell/bag_of_cells.rs:118:42
    |
118 |                 Self::traverse_cell_tree(&r, all_cells, in_refs)?;
    |                                          ^^ help: change this to: `r`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/cell/bag_of_cells.rs:129:38
    |
129 |             Self::traverse_cell_tree(&r, &mut all_cells, &mut in_refs)?;
    |                                      ^^ help: change this to: `r`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: using `clone` on type `usize` which implements the `Copy` trait
   --> src/cell/bag_of_cells.rs:164:26
    |
164 |                 .map(|c| indices.get(c).unwrap().clone())
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*indices.get(c).unwrap()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `usize` which implements the `Copy` trait
   --> src/cell/bag_of_cells.rs:177:22
    |
177 |             .map(|c| indices.get(c).unwrap().clone())
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*indices.get(c).unwrap()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: you should consider adding a `Default` implementation for `CellBuilder`
  --> src/cell/builder.rs:19:5
   |
19 | /     pub fn new() -> CellBuilder {
20 | |         let bit_writer = BitWriter::endian(Vec::new(), BigEndian);
21 | |         CellBuilder {
22 | |             bit_writer,
23 | |             references: Vec::new(),
24 | |         }
25 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
   = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
   |
18 + impl Default for CellBuilder {
19 +     fn default() -> Self {
20 +         Self::new()
21 +     }
22 + }
   |

warning: casting integer literal to `u32` is unnecessary
  --> src/cell/parser.rs:60:40
   |
60 |         let mut words: Vec<u32> = vec![0 as u32; num_words];
   |                                        ^^^^^^^^ help: try: `0_u32`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting integer literal to `u8` is unnecessary
  --> src/cell/parser.rs:80:28
   |
80 |         let mut res = vec![0 as u8; num_bytes];
   |                            ^^^^^^^ help: try: `0_u8`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting integer literal to `u8` is unnecessary
   --> src/cell/parser.rs:111:38
    |
111 |                 let mut hash_part = [0 as u8; 32];
    |                                      ^^^^^^^ help: try: `0_u8`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: manual implementation of an assign operation
   --> src/cell/parser.rs:125:13
    |
125 |             res = res + 1;
    |             ^^^^^^^^^^^^^ help: replace it with: `res += 1`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
    = note: `#[warn(clippy::assign_op_pattern)]` on by default

warning: useless conversion to the same type: `u8`
  --> src/cell/raw.rs:54:28
   |
54 |                 let size = (header & 0b0000_0111).into();
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `(header & 0b0000_0111)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
   = note: `#[warn(clippy::useless_conversion)]` on by default

warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
  --> src/cell.rs:32:1
   |
32 | impl Into<Vec<Cell>> for Cell {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
           https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
   = note: `#[warn(clippy::from_over_into)]` on by default
help: replace the `Into` implementation with `From<cell::Cell>`
   |
32 ~ impl From<Cell> for Vec<Cell> {
33 ~     fn from(val: Cell) -> Self {
34 ~         vec![val]
   |

warning: returning the result of a `let` binding from a block
  --> src/cell.rs:67:9
   |
66 |         let res = parse(&mut reader);
   |         ----------------------------- unnecessary `let` binding
67 |         res
   |         ^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
   = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
   |
66 ~         
67 ~         parse(&mut reader)
   |

warning: unneeded `return` statement
  --> src/cell.rs:86:9
   |
86 |         return max_level;
   |         ^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
86 -         return max_level;
86 +         max_level
   |

warning: unneeded `return` statement
   --> src/cell.rs:100:9
    |
100 |         return max_depth;
    |         ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
100 -         return max_depth;
100 +         max_depth
    |

warning: length comparison to zero
  --> src/cell.rs:91:12
   |
91 |         if self.references.len() > 0 {
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.references.is_empty()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
   = note: `#[warn(clippy::len_zero)]` on by default

warning: manual implementation of an assign operation
  --> src/cell.rs:98:13
   |
98 |             max_depth = max_depth + 1;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `max_depth += 1`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: question mark operator is useless here
   --> src/cell.rs:153:9
    |
153 |         Ok(result?)
    |         ^^^^^^^^^^^ help: try removing question mark and `Ok()`: `result`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
    = note: `#[warn(clippy::needless_question_mark)]` on by default

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/cell.rs:297:31
    |
297 |             let r = extractor(&self)?;
    |                               ^^^^^ help: change this to: `self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: this expression creates a reference which is immediately dereferenced by the compiler
  --> src/client/block_functions.rs:59:41
   |
59 |                 .get_block_transactions(&shard_id, mode, 256, &after)
   |                                         ^^^^^^^^^ help: change this to: `shard_id`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: you should consider adding a `Default` implementation for `TonClientBuilder`
  --> src/client/builder.rs:20:5
   |
20 | /     pub fn new() -> Self {
21 | |         TonClientBuilder {
22 | |             pool_size: 1,
23 | |             connection_params: TonConnectionParams::default(),
...  |
27 | |         }
28 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
   |
19 + impl Default for TonClientBuilder {
20 +     fn default() -> Self {
21 +         Self::new()
22 +     }
23 + }
   |

warning: redundant closure
   --> src/client/connection.rs:134:58
    |
134 |                     blockchain_name: blockchain_name.map(|s| String::from(s)),
    |                                                          ^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `String::from`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
    = note: `#[warn(clippy::redundant_closure)]` on by default

warning: useless conversion to the same type: `tl::result::TonResultDiscriminants`
   --> src/client/connection.rs:145:17
    |
145 |                 TonResultDiscriminants::OptionsInfo.into(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `TonResultDiscriminants::OptionsInfo`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
   --> src/client/connection.rs:159:16
    |
159 |         stack: &Vec<TvmStackEntry>,
    |                ^^^^^^^^^^^^^^^^^^^ help: change this to: `&[TvmStackEntry]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
    = note: `#[warn(clippy::ptr_arg)]` on by default

warning: redundant pattern matching, consider using `is_err()`
   --> src/client/connection.rs:275:28
    |
275 |                     if let Err(_) = data.sender.send(result) {
    |                     -------^^^^^^--------------------------- help: try: `if data.sender.send(result).is_err()`
    |
    = note: this will change drop order of the result, as well as all temporaries
    = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
    = note: `#[warn(clippy::redundant_pattern_matching)]` on by default

warning: manual implementation of `Option::map`
   --> src/client/connection.rs:293:41
    |
293 |   ...                   let extra = match &maybe_extra {
    |  ___________________________________^
294 | | ...                       Some(s) => Some(s.as_str()),
295 | | ...                       None => None,
296 | | ...                   };
    | |_______________________^ help: try: `maybe_extra.as_ref().map(|s| s.as_str())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
    = note: `#[warn(clippy::manual_map)]` on by default

warning: returning the result of a `let` binding from a block
  --> src/client.rs:98:9
   |
97 |         let result = RetryIf::spawn(strategy, || self.do_invoke(function), retry_condition).await;
   |         ------------------------------------------------------------------------------------------ unnecessary `let` binding
98 |         result
   |         ^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
   |
97 ~         
98 ~         RetryIf::spawn(strategy, || self.do_invoke(function), retry_condition).await
   |

warning: returning the result of a `let` binding from a block
   --> src/client.rs:120:9
    |
119 |         let entry = &self.inner.connections[i];
    |         --------------------------------------- unnecessary `let` binding
120 |         entry
    |         ^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
    |
119 ~         
120 ~         (&self.inner.connections[i]) as _
    |

warning: useless conversion to the same type: `tl::error::TvmStackError`
  --> src/contract/error.rs:84:20
   |
84 |             error: e.into(),
   |                    ^^^^^^^^ help: consider removing `.into()`: `e`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
  --> src/contract/interface.rs:24:16
   |
24 |         stack: &Vec<TvmStackEntry>,
   |                ^^^^^^^^^^^^^^^^^^^ help: change this to: `&'life2 [TvmStackEntry]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

warning: manual implementation of an assign operation
   --> src/contract/latest_transactions_cache.rs:101:25
    |
101 |                         batch_size = batch_size / 2;
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `batch_size /= 2`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: length comparison to zero
   --> src/contract/latest_transactions_cache.rs:126:12
    |
126 |         if loaded.len() > 0 {
    |            ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!loaded.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

error: redundant redefinition of a binding `method`
  --> src/contract/nft/item_contract.rs:48:13
   |
48 |             let method = method;
   |             ^^^^^^^^^^^^^^^^^^^^
   |
help: `method` is initially defined here
  --> src/contract/nft/item_contract.rs:42:13
   |
42 |         let method = NftItemContractMethods::GetNftData.into();
   |             ^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals
   = note: `#[deny(clippy::redundant_locals)]` on by default

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/contract/nft/item_contract.rs:110:64
    |
110 |             let boc = stack.get_boc(0).map_stack_error(method, &self.address())?;
    |                                                                ^^^^^^^^^^^^^^^ help: change this to: `self.address()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: this expression creates a reference which is immediately dereferenced by the compiler
  --> src/contract/state.rs:43:38
   |
43 |             .smc_load_by_transaction(&address, transaction_id)
   |                                      ^^^^^^^^ help: change this to: `address`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: useless conversion to the same type: `&str`
  --> src/contract/wallet/wallet_contract.rs:29:34
   |
29 |                 .map_stack_error(method.into(), self.address())? as u32;
   |                                  ^^^^^^^^^^^^^ help: consider removing `.into()`: `method`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

warning: returning the result of a `let` binding from a block
  --> src/contract.rs:36:9
   |
32 | /         let contract = TonContract {
33 | |             factory: factory.clone(),
34 | |             address: address.clone(),
35 | |         };
   | |__________- unnecessary `let` binding
36 |           contract
   |           ^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
   |
32 ~         
33 ~         TonContract {
34 +             factory: factory.clone(),
35 +             address: address.clone(),
36 +         }
   |

warning: unnecessary closure used to substitute value for `Option::None`
   --> src/message/jetton.rs:106:13
    |
106 | /             self.response_destination
107 | |                 .as_ref()
108 | |                 .unwrap_or_else(|| &TonAddress::NULL),
    | |__________________-----------------------------------^
    |                    |
    |                    help: use `unwrap_or(..)` instead: `unwrap_or(&TonAddress::NULL)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
    = note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/message/jetton.rs:112:37
    |
112 |             message.store_reference(&cp)?;
    |                                     ^^^ help: change this to: `cp`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: method `default` can be confused for the standard trait method `std::default::Default::default`
  --> src/meta/ipfs_loader.rs:64:5
   |
64 | /     pub fn default() -> Result<Self, IpfsLoaderError> {
65 | |         Self::new(&IpfsLoaderConfig::default())
66 | |     }
   | |_____^
   |
   = help: consider implementing the trait `std::default::Default` or choosing a less ambiguous method name
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
   = note: `#[warn(clippy::should_implement_trait)]` on by default

warning: unnecessary use of `to_vec`
  --> src/meta/ipfs_loader.rs:85:72
   |
85 |             let body = String::from_utf8_lossy(&response.bytes().await?.to_vec()).to_string();
   |                                                                        ^^^^^^^^^ help: remove this
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
   = note: `#[warn(clippy::unnecessary_to_owned)]` on by default

warning: unnecessary use of `to_vec`
  --> src/meta.rs:35:29
   |
35 |         let s = hex::encode(hasher.finalize()[..].to_vec());
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `&hasher.finalize()[..]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

warning: method `default` can be confused for the standard trait method `std::default::Default::default`
  --> src/meta.rs:90:5
   |
90 | /     pub fn default() -> Result<MetaLoader<MetaData>, MetaLoaderError> {
91 | |         let http_client = reqwest::Client::builder().build()?;
92 | |         let ipfs_loader = IpfsLoader::new(&IpfsLoaderConfig::default())?; // Replace with actual initialization
93 | |         Ok(MetaLoader {
...  |
97 | |         })
98 | |     }
   | |_____^
   |
   = help: consider implementing the trait `std::default::Default` or choosing a less ambiguous method name
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait

warning: useless conversion to the same type: `std::str::Chars<'_>`
   --> src/meta.rs:103:32
    |
103 |             let path: String = uri.chars().into_iter().skip(7).collect();
    |                                ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `uri.chars()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

warning: single-character string constant used as pattern
  --> src/mnemonic.rs:20:20
   |
20 |             .split("\n")
   |                    ^^^^ help: try using a `char` instead: `'\n'`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

warning: single-character string constant used as pattern
   --> src/mnemonic.rs:100:20
    |
100 |             .split(" ")
    |                    ^^^ help: try using a `char` instead: `' '`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
   --> src/mnemonic.rs:118:22
    |
118 | fn to_entropy(words: &Vec<String>, password: &Option<String>) -> Result<Vec<u8>, MnemonicError> {
    |                      ^^^^^^^^^^^^ help: change this to: `&[String]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

warning: redundant closure
  --> src/tl/serial.rs:60:47
   |
60 |         serde_json::from_value(value).map_err(|e| TlError::SerdeJsonError(e));
   |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TlError::SerdeJsonError`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

warning: you should consider adding a `Default` implementation for `TvmStack`
  --> src/tl/stack.rs:91:5
   |
91 | /     pub fn new() -> TvmStack {
92 | |         TvmStack {
93 | |             elements: Vec::new(),
94 | |         }
95 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
   |
90 + impl Default for TvmStack {
91 +     fn default() -> Self {
92 +         Self::new()
93 +     }
94 + }
   |

warning: question mark operator is useless here
   --> src/tl/stack.rs:130:30
    |
130 |             .parse_fully(|r| Ok(r.load_address()?))
    |                              ^^^^^^^^^^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `r.load_address()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark

warning: redundant closure
   --> src/tl/stack.rs:131:22
    |
131 |             .map_err(|e| TvmStackError::TonCellError(e))
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `TvmStackError::TonCellError`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

error: type `tl::types::InternalTransactionId` implements inherent method `to_string(&self) -> String` which shadows the implementation of `Display`
   --> src/tl/types.rs:122:5
    |
122 | /     pub fn to_string(&self) -> String {
123 | |         format!("{}:{}", self.lt, self.hash_string())
124 | |     }
    | |_____^
    |
    = help: remove the inherent method from type `tl::types::InternalTransactionId`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string_shadow_display
    = note: `#[deny(clippy::inherent_to_string_shadow_display)]` on by default

warning: single-character string constant used as pattern
   --> src/tl/types.rs:143:37
    |
143 |         let parts: Vec<_> = s.split(":").collect();
    |                                     ^^^ help: try using a `char` instead: `':'`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

warning: returning the result of a `let` binding from a block
  --> src/tl.rs:67:9
   |
56 | /         let result = unsafe {
57 | |             let c_str = tonlib_client_json_execute(self.ptr, f_str.as_ptr());
58 | |             log::trace!(
59 | |                 "[{}] result: {}",
...  |
65 | |             deserialize_result(c_str)
66 | |         };
   | |__________- unnecessary `let` binding
67 |           result
   |           ^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
   |
56 ~         
57 ~         unsafe {
58 +             let c_str = tonlib_client_json_execute(self.ptr, f_str.as_ptr());
59 +             log::trace!(
60 +                 "[{}] result: {}",
61 +                 self.tag,
62 +                 CStr::from_ptr(c_str)
63 +                     .to_str()
64 +                     .unwrap_or("<Error decoding string as UTF-8>")
65 +             );
66 +             deserialize_result(c_str)
67 +         }
   |

warning: match expression looks like `matches!` macro
  --> src/wallet.rs:66:9
   |
66 | /         match self {
67 | |             WalletVersion::V4R2 => true,
68 | |             _ => false,
69 | |         }
   | |_________^ help: try: `matches!(self, WalletVersion::V4R2)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
   = note: `#[warn(clippy::match_like_matches_macro)]` on by default

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/wallet.rs:151:33
    |
151 |         body_builder.store_cell(&external_body)?;
    |                                 ^^^^^^^^^^^^^^ help: change this to: `external_body`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: `tonlib` (lib) generated 66 warnings
error: could not compile `tonlib` (lib) due to 2 previous errors; 66 warnings emitted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment