-
Notifications
You must be signed in to change notification settings - Fork 490
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
feat: while
loop formatting is off
#4953
Comments
are using the latest version? locally this does not replicate for me. |
Yes #[starknet::interface]
trait IPool<TContractState> {
fn create_pool(ref self: TContractState, asset_params: Span<AssetParams>, ltv_params: Span<LTVParams>) -> felt252;
}
#[starknet::contract]
mod Pool {
#[abi(embed_v0)]
impl poolImpl of super::IPool<ContractState> {
fn create_pool(
ref self: ContractState, mut asset_params: Span<AssetParams>, mut ltv_params: Span<LTVParams>,
) -> felt252 {
while !asset_params.is_empty() {
let params = *asset_params.pop_front().unwrap();
assert(params.floor != 0, 'floor-zero');
};
while !ltv_params.is_empty() {
let params = *ltv_params.pop_front().unwrap();
self.max_position_ltvs.write((params.foo, params.bar), params.ltv);
};
42
}
}
} |
Thanks for the full example - now it replicates - will fix soon. |
fell free to add here - but do note that sending pictures is not usable - as everything is context dependent. |
sure, the pictures show diffs better. here's the text: #[starknet::contract]
mod DefaultExtension {
#[storage]
struct Storage {}
#[abi(embed_v0)]
impl ExtensionImpl of IExtension<ContractState> {
fn rate_accumulator(self: @ContractState) -> (u256, u256) {
self.interest_rate_model.rate_accumulator(
pool_id, asset, utilization, last_updated, last_rate_accumulator, last_full_utilization_rate
)
}
}
} |
The actual result for this is:
Which is correct since the line is longer than 100 chars. |
Ah sorry this is formatted with length of 120, my point still holds with a
shorter example and length < 100
El El jue, 1 feb 2024 a la(s) 7:35, orizi ***@***.***>
escribió:
… The actual result for this is:
#[starknet::contract]
mod DefaultExtension {
#[storage]
struct Storage {}
#[abi(embed_v0)]
impl ExtensionImpl of IExtension<ContractState> {
fn rate_accumulator(self: @ContractState) -> (u256, u256) {
self
.interest_rate_model
.rate_accumulator(
pool_id,
asset,
utilization,
last_updated,
last_rate_accumulator,
last_full_utilization_rate
)
}
}
}
Which is correct since the line is longer than 100 chars.
—
Reply to this email directly, view it on GitHub
<#4953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIKSPBS2JLJGAM3RYGQHETYROKYPAVCNFSM6AAAAABCPSYKZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRRGMZTSNJQGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Here it is the proposal for line legnth 100: #[starknet::contract]
mod DefaultExtension {
#[storage]
struct Storage {}
#[abi(embed_v0)]
impl ExtensionImpl of IExtension<ContractState> {
fn rate_accumulator(self: @ContractState) -> (u256, u256) {
self.interest_rate_model.rate_accumulator(
pool_id,
asset,
utilization,
last_updated,
last_rate_accumulator,
last_full_utilization_rate
)
}
}
} instead of: #[starknet::contract]
mod DefaultExtension {
#[storage]
struct Storage {}
#[abi(embed_v0)]
impl ExtensionImpl of IExtension<ContractState> {
fn rate_accumulator(self: @ContractState) -> (u256, u256) {
self
.interest_rate_model
.rate_accumulator(
pool_id,
asset,
utilization,
last_updated,
last_rate_accumulator,
last_full_utilization_rate
)
}
}
} |
This needs to include a more complex algorithm than we are planning in the scope of the basic formatter - at it needs to try multiple different attempts at splitting the text - which would be to complex for the basic. |
i believe it should stay as before (red), after running
scarb fmt
(green):The text was updated successfully, but these errors were encountered: