Skip to content

chore: upgrade rust to 1.87 #5647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2025
Merged

chore: upgrade rust to 1.87 #5647

merged 3 commits into from
May 16, 2025

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented May 16, 2025

Summary of changes

Changes introduced in this pull request:

  • upgrade rust toolchain to 1.87
  • fix clippy warnings
warning: this can be `std::io::Error::other(_)`
   --> src/db/car/forest/index/mod.rs:221:13
    |
221 |             io::Error::new(io::ErrorKind::Other, "couldn't get end of table size")
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error
    = note: `#[warn(clippy::io_other_error)]` on by default
help: use `std::io::Error::other`
    |
221 -             io::Error::new(io::ErrorKind::Other, "couldn't get end of table size")
221 +             io::Error::other("couldn't get end of table size")
    |

warning: large size difference between variants
   --> src/rpc/client.rs:253:1
    |
253 | / enum UrlClientInner {
254 | |     Ws(jsonrpsee::ws_client::WsClient),
    | |     ---------------------------------- the second-largest variant contains at least 80 bytes
255 | |     Https(jsonrpsee::http_client::HttpClient),
    | |     ----------------------------------------- the largest variant contains at least 456 bytes
256 | | }
    | |_^ the entire enum is at least 456 bytes
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
    = note: `#[warn(clippy::large_enum_variant)]` on by default
help: consider boxing the large fields to reduce the total size of the enum
    |
255 -     Https(jsonrpsee::http_client::HttpClient),
255 +     Https(Box<jsonrpsee::http_client::HttpClient>),
    |

warning: returning the result of a `let` binding from a block
   --> src/rpc/methods/eth/filter/mod.rs:553:13
    |
540 | /             let matched = entries.iter().enumerate().all(|(i, entry)| {
541 | |                 if let Some(slice) = get_word(entry.value()) {
542 | |                     let hash: EthHash = (*slice).into();
543 | |                     match spec.0.get(i) {
...   |
552 | |             });
    | |_______________- unnecessary `let` binding
553 |               matched
    |               ^^^^^^^
    |
    = 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
    |
540 ~
541 ~             entries.iter().enumerate().all(|(i, entry)| {
542 +                 if let Some(slice) = get_word(entry.value()) {
543 +                     let hash: EthHash = (*slice).into();
544 +                     match spec.0.get(i) {
545 +                         Some(EthHashList::List(vec)) => vec.contains(&hash),
546 +                         Some(EthHashList::Single(Some(h))) => h == &hash,
547 +                         _ => true, /* wildcard */
548 +                     }
549 +                 } else {
550 +                     // Drop events with mis-sized topics
551 +                     false
552 +                 }
553 +             })
    |

warning: using `contains()` instead of `iter().any()` is more efficient
   --> src/rpc/methods/eth/filter/mod.rs:749:13
    |
749 |             self.addresses.iter().any(|other| *other == *emitter_addr)
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.addresses.contains(emitter_addr)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains
    = note: `#[warn(clippy::manual_contains)]` on by default

warning: returning the result of a `let` binding from a block
   --> src/rpc/methods/eth/filter/mod.rs:762:13
    |
755 | /             let matched = self.keys.iter().all(|(k, v)| {
756 | |                 entries.iter().any(|entry| {
757 | |                     k == entry.key()
758 | |                         && v.iter()
759 | |                             .any(|aeb| aeb.codec == entry.codec() && &aeb.value == entry.value())
760 | |                 })
761 | |             });
    | |_______________- unnecessary `let` binding
762 |               matched
    |               ^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
    |
755 ~
756 ~             self.keys.iter().all(|(k, v)| {
757 +                 entries.iter().any(|entry| {
758 +                     k == entry.key()
759 +                         && v.iter()
760 +                             .any(|aeb| aeb.codec == entry.codec() && &aeb.value == entry.value())
761 +                 })
762 +             })
    |

warning: using `contains()` instead of `iter().any()` is more efficient
   --> src/rpc/methods/eth/filter/mod.rs:778:13
    |
778 |             self.addresses.iter().any(|other| *other == *resolved)
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.addresses.contains(resolved)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains

warning: using `contains()` instead of `iter().any()` is more efficient
   --> src/rpc/methods/eth/types.rs:692:47
    |
692 |             if !from_addresses.is_empty() && !from_addresses.iter().any(|addr| *addr == trace_from)
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `from_addresses.contains(&trace_from)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains

warning: returning the result of a `let` binding from a block
   --> src/message_pool/msgpool/test_provider.rs:118:9
    |
111 | /         let new_block = mock_block_with_parents(
112 | |             self.tipsets
113 | |                 .last()
114 | |                 .unwrap_or(&Tipset::from(mock_block(1, 1))),
115 | |             1,
116 | |             1,
117 | |         );
    | |__________- unnecessary `let` binding
118 |           new_block
    |           ^^^^^^^^^
    |
    = 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
    |
111 ~
112 ~         mock_block_with_parents(
113 +             self.tipsets
114 +                 .last()
115 +                 .unwrap_or(&Tipset::from(mock_block(1, 1))),
116 +             1,
117 +             1,
118 +         )
    |

warning: returning the result of a `let` binding from a block
   --> src/rpc/methods/eth/filter/mod.rs:553:13
    |
540 | /             let matched = entries.iter().enumerate().all(|(i, entry)| {
541 | |                 if let Some(slice) = get_word(entry.value()) {
542 | |                     let hash: EthHash = (*slice).into();
543 | |                     match spec.0.get(i) {
...   |
552 | |             });
    | |_______________- unnecessary `let` binding
553 |               matched
    |               ^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
    |
540 ~
541 ~             entries.iter().enumerate().all(|(i, entry)| {
542 +                 if let Some(slice) = get_word(entry.value()) {
543 +                     let hash: EthHash = (*slice).into();
544 +                     match spec.0.get(i) {
545 +                         Some(EthHashList::List(vec)) => vec.contains(&hash),
546 +                         Some(EthHashList::Single(Some(h))) => h == &hash,
547 +                         _ => true, /* wildcard */
548 +                     }
549 +                 } else {
550 +                     // Drop events with mis-sized topics
551 +                     false
552 +                 }
553 +             })
    |

warning: `forest-filecoin` (lib) generated 7 warnings (run `cargo clippy --fix --lib -p forest-filecoin` to apply 6 suggestions)
warning: `forest-filecoin` (lib test) generated 8 warnings (6 duplicates) (run `cargo clippy --fix --lib -p forest-filecoin --tests` to apply 2 suggestions)
    Finished `dev` profile [unoptimized] target(s) in 48.04s

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@hanabi1224 hanabi1224 marked this pull request as ready for review May 16, 2025 07:32
@hanabi1224 hanabi1224 requested a review from a team as a code owner May 16, 2025 07:32
@hanabi1224 hanabi1224 requested review from elmattic and removed request for a team May 16, 2025 07:32
@elmattic elmattic added this pull request to the merge queue May 16, 2025
Merged via the queue into main with commit 281d8a0 May 16, 2025
34 checks passed
@elmattic elmattic deleted the hm/rust-1.87 branch May 16, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants