-
Notifications
You must be signed in to change notification settings - Fork 151
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
chore: pre-release mega cleanup #35
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
replace `fn (\w+)<\w+>(.*)\n\s*where\n\s*(.*),\n\s*\{` with `fn $1<$3>$2 {`
script: ```rust fn main() { for file in std::env::args().skip(1) { let s = std::fs::read_to_string(&file).unwrap(); let mut lines = s.lines().map(ToString::to_string).collect::<Vec<_>>(); let len = lines.len().saturating_sub(1); for i in 0..len { let a = lines[i].trim(); let b = lines[i + 1].trim(); if a.starts_with("///") && !b.starts_with("///") && !a.ends_with('.') && !a.ends_with('>') && !a.ends_with('`') && !a.starts_with("/// [") && !a.ends_with("///") { lines[i].push('.'); } } let mut lines: String = lines.join("\n"); if s.ends_with('\n') { lines.push('\n'); } std::fs::write(file, lines).unwrap(); } } ```
I assume this was inherited from Parity crates, but it is generally a bad practice. This commit simplifies `no_std_prelude` imports. Since `alloc` does not have to be gated on the `std` feature, we can strip down the module to the basic `std` prelude items.
prestwich
reviewed
May 15, 2023
prestwich
reviewed
May 15, 2023
prestwich
reviewed
May 15, 2023
@@ -44,41 +42,36 @@ use crate::{no_std_prelude::*, token::TokenSeq, AbiResult, TokenType, Word}; | |||
/// const MY_STRUCT: MyStruct = MyStruct { a: true, b: [0x01, 0x02] }; | |||
/// ``` | |||
pub trait SolType { | |||
/// The corresponding Rust type. This type may be borrowed (e.g. `str`) | |||
/// The corresponding Rust type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried hard to make that borrow work and could not get it ergonomically
/// Structs and enums: | ||
/// | ||
/// ```ignore. | ||
#[doc = include_str!("../../abi/tests/doc_structs.rs")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love it
prestwich
approved these changes
May 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main changes (which I can remember):
#[inline]
where it makes sensesol!
docs and doctests, tested inethers-abi-enc
encode
take&T
, likeEncoder::*
methods, which allows removingClone
bound and callsconst-hex
methods, including in fmt impls for fixed typescrates/abi/src/coder/impl_core.rs
for no alloc FixedArray encoding -- this is modified frombincode
and libcoreAbiResult
toResult
TokenSeq
'sfn can_be_params() -> bool
withconst IS_TUPLE: bool
encode_with_selector
->encode
to mimicdecode_raw, decode
.serde_json::json
tests because VSCode auto detects the file as 2 line indentThings I discovered:
Signed::to_{be,le}_bytes
is not generic overN
, when it should beencode_packed_to
does not produce the expected result with integers that useSigned
orU256
, so I made the comment a TODO. Packed encoding is just not tested in general.