Skip to content

Commit ac4e5f5

Browse files
authored
fix linter warning (#17820)
* fix move linter warning in aptos-experimental * docs
1 parent b93ba2e commit ac4e5f5

File tree

12 files changed

+60
-79
lines changed

12 files changed

+60
-79
lines changed

aptos-move/framework/aptos-experimental/doc/bulk_order_book_types.md

Lines changed: 29 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -102,34 +102,32 @@ ask_sizes
102102
- [Aborts:](#@Aborts:_22)
103103
- [Function `discard_price_crossing_levels`](#0x7_bulk_order_book_types_discard_price_crossing_levels)
104104
- [Function `new_bulk_order_match`](#0x7_bulk_order_book_types_new_bulk_order_match)
105-
- [Arguments:](#@Arguments:_23)
106-
- [Returns:](#@Returns:_24)
107105
- [Function `get_total_remaining_size`](#0x7_bulk_order_book_types_get_total_remaining_size)
108106
- [Function `get_unique_priority_idx`](#0x7_bulk_order_book_types_get_unique_priority_idx)
107+
- [Arguments:](#@Arguments:_23)
108+
- [Returns:](#@Returns:_24)
109+
- [Function `get_order_id`](#0x7_bulk_order_book_types_get_order_id)
109110
- [Arguments:](#@Arguments:_25)
110111
- [Returns:](#@Returns:_26)
111-
- [Function `get_order_id`](#0x7_bulk_order_book_types_get_order_id)
112+
- [Function `get_account`](#0x7_bulk_order_book_types_get_account)
112113
- [Arguments:](#@Arguments:_27)
113114
- [Returns:](#@Returns:_28)
114-
- [Function `get_account`](#0x7_bulk_order_book_types_get_account)
115+
- [Function `get_active_price`](#0x7_bulk_order_book_types_get_active_price)
115116
- [Arguments:](#@Arguments:_29)
116117
- [Returns:](#@Returns:_30)
117-
- [Function `get_active_price`](#0x7_bulk_order_book_types_get_active_price)
118-
- [Arguments:](#@Arguments:_31)
119-
- [Returns:](#@Returns:_32)
120118
- [Function `get_all_prices`](#0x7_bulk_order_book_types_get_all_prices)
121119
- [Function `get_all_sizes`](#0x7_bulk_order_book_types_get_all_sizes)
122120
- [Function `get_active_size`](#0x7_bulk_order_book_types_get_active_size)
123-
- [Arguments:](#@Arguments:_33)
124-
- [Returns:](#@Returns:_34)
121+
- [Arguments:](#@Arguments:_31)
122+
- [Returns:](#@Returns:_32)
125123
- [Function `reinsert_order`](#0x7_bulk_order_book_types_reinsert_order)
126-
- [Arguments:](#@Arguments:_35)
124+
- [Arguments:](#@Arguments:_33)
127125
- [Function `match_order_and_get_next`](#0x7_bulk_order_book_types_match_order_and_get_next)
128-
- [Arguments:](#@Arguments:_36)
129-
- [Returns:](#@Returns:_37)
130-
- [Aborts:](#@Aborts:_38)
126+
- [Arguments:](#@Arguments:_34)
127+
- [Returns:](#@Returns:_35)
128+
- [Aborts:](#@Aborts:_36)
131129
- [Function `set_empty`](#0x7_bulk_order_book_types_set_empty)
132-
- [Arguments:](#@Arguments:_39)
130+
- [Arguments:](#@Arguments:_37)
133131
- [Function `destroy_bulk_order`](#0x7_bulk_order_book_types_destroy_bulk_order)
134132

135133

@@ -872,26 +870,10 @@ Validates a bulk order request for correctness.
872870

873871
## Function `new_bulk_order_match`
874872

875-
Creates a new single bulk order match result.
876-
877-
878-
<a id="@Arguments:_23"></a>
879-
880-
### Arguments:
881-
882-
- <code>order</code>: Reference to the bulk order being matched
883-
- <code>is_bid</code>: True if matching against bid side, false for ask side
884-
- <code>matched_size</code>: Size that was matched in this operation
885-
886873

887-
<a id="@Returns:_24"></a>
888-
889-
### Returns:
890-
891-
A <code>SingleBulkOrderMatch</code> containing the match details.
892874

893-
894-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="bulk_order_book_types.md#0x7_bulk_order_book_types_new_bulk_order_match">new_bulk_order_match</a>&lt;M: <b>copy</b>, drop, store&gt;(order: &<b>mut</b> <a href="bulk_order_book_types.md#0x7_bulk_order_book_types_BulkOrder">bulk_order_book_types::BulkOrder</a>&lt;M&gt;, is_bid: bool, matched_size: u64): <a href="order_book_types.md#0x7_order_book_types_OrderMatch">order_book_types::OrderMatch</a>&lt;M&gt;
875+
<pre><code>#[lint::skip(#[needless_mutable_reference])]
876+
<b>public</b>(<b>friend</b>) <b>fun</b> <a href="bulk_order_book_types.md#0x7_bulk_order_book_types_new_bulk_order_match">new_bulk_order_match</a>&lt;M: <b>copy</b>, drop, store&gt;(order: &<b>mut</b> <a href="bulk_order_book_types.md#0x7_bulk_order_book_types_BulkOrder">bulk_order_book_types::BulkOrder</a>&lt;M&gt;, is_bid: bool, matched_size: u64): <a href="order_book_types.md#0x7_order_book_types_OrderMatch">order_book_types::OrderMatch</a>&lt;M&gt;
895877
</code></pre>
896878

897879

@@ -971,14 +953,14 @@ A <code>SingleBulkOrderMatch</code> containing the match details.
971953
Gets the unique priority index of a bulk order.
972954

973955

974-
<a id="@Arguments:_25"></a>
956+
<a id="@Arguments:_23"></a>
975957

976958
### Arguments:
977959

978960
- <code>self</code>: Reference to the bulk order
979961

980962

981-
<a id="@Returns:_26"></a>
963+
<a id="@Returns:_24"></a>
982964

983965
### Returns:
984966

@@ -1012,14 +994,14 @@ The unique priority index for time-based ordering.
1012994
Gets the order ID of a bulk order.
1013995

1014996

1015-
<a id="@Arguments:_27"></a>
997+
<a id="@Arguments:_25"></a>
1016998

1017999
### Arguments:
10181000

10191001
- <code>self</code>: Reference to the bulk order
10201002

10211003

1022-
<a id="@Returns:_28"></a>
1004+
<a id="@Returns:_26"></a>
10231005

10241006
### Returns:
10251007

@@ -1053,14 +1035,14 @@ The unique order identifier.
10531035
Gets the account of a bulk order.
10541036

10551037

1056-
<a id="@Arguments:_29"></a>
1038+
<a id="@Arguments:_27"></a>
10571039

10581040
### Arguments:
10591041

10601042
- <code>self</code>: Reference to the bulk order
10611043

10621044

1063-
<a id="@Returns:_30"></a>
1045+
<a id="@Returns:_28"></a>
10641046

10651047
### Returns:
10661048

@@ -1094,15 +1076,15 @@ The account that placed the order.
10941076
Gets the active price for a specific side of a bulk order.
10951077

10961078

1097-
<a id="@Arguments:_31"></a>
1079+
<a id="@Arguments:_29"></a>
10981080

10991081
### Arguments:
11001082

11011083
- <code>self</code>: Reference to the bulk order
11021084
- <code>is_bid</code>: True to get bid price, false for ask price
11031085

11041086

1105-
<a id="@Returns:_32"></a>
1087+
<a id="@Returns:_30"></a>
11061088

11071089
### Returns:
11081090

@@ -1204,15 +1186,15 @@ An option containing the active price if available, none otherwise.
12041186
Gets the active size for a specific side of a bulk order.
12051187

12061188

1207-
<a id="@Arguments:_33"></a>
1189+
<a id="@Arguments:_31"></a>
12081190

12091191
### Arguments:
12101192

12111193
- <code>self</code>: Reference to the bulk order
12121194
- <code>is_bid</code>: True to get bid size, false for ask size
12131195

12141196

1215-
<a id="@Returns:_34"></a>
1197+
<a id="@Returns:_32"></a>
12161198

12171199
### Returns:
12181200

@@ -1262,7 +1244,7 @@ of the bulk order. If the price already exists at the first level, it increases
12621244
the size; otherwise, it inserts the new price level at the front.
12631245

12641246

1265-
<a id="@Arguments:_35"></a>
1247+
<a id="@Arguments:_33"></a>
12661248

12671249
### Arguments:
12681250

@@ -1315,7 +1297,7 @@ This function reduces the size at the first price level by the matched size.
13151297
If the first level becomes empty, it is removed and the next level becomes active.
13161298

13171299

1318-
<a id="@Arguments:_36"></a>
1300+
<a id="@Arguments:_34"></a>
13191301

13201302
### Arguments:
13211303

@@ -1324,14 +1306,14 @@ If the first level becomes empty, it is removed and the next level becomes activ
13241306
- <code>matched_size</code>: Size that was matched in this operation
13251307

13261308

1327-
<a id="@Returns:_37"></a>
1309+
<a id="@Returns:_35"></a>
13281310

13291311
### Returns:
13301312

13311313
A tuple containing the next active price and size as options.
13321314

13331315

1334-
<a id="@Aborts:_38"></a>
1316+
<a id="@Aborts:_36"></a>
13351317

13361318
### Aborts:
13371319

@@ -1383,7 +1365,7 @@ A tuple containing the next active price and size as options.
13831365
Sets the bulk order to empty state by clearing all sizes.
13841366

13851367

1386-
<a id="@Arguments:_39"></a>
1368+
<a id="@Arguments:_37"></a>
13871369

13881370
### Arguments:
13891371

aptos-move/framework/aptos-experimental/doc/confidential_asset.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ Returns the encryption key (EK) of the user for the specified token.
15701570
<a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_not_found">error::not_found</a>(<a href="confidential_asset.md#0x7_confidential_asset_ECA_STORE_NOT_PUBLISHED">ECA_STORE_NOT_PUBLISHED</a>)
15711571
);
15721572

1573-
<b>borrow_global_mut</b>&lt;<a href="confidential_asset.md#0x7_confidential_asset_ConfidentialAssetStore">ConfidentialAssetStore</a>&gt;(<a href="confidential_asset.md#0x7_confidential_asset_get_user_address">get_user_address</a>(user, token)).ek
1573+
<b>borrow_global</b>&lt;<a href="confidential_asset.md#0x7_confidential_asset_ConfidentialAssetStore">ConfidentialAssetStore</a>&gt;(<a href="confidential_asset.md#0x7_confidential_asset_get_user_address">get_user_address</a>(user, token)).ek
15741574
}
15751575
</code></pre>
15761576

aptos-move/framework/aptos-experimental/doc/market_types.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,8 @@
15631563

15641564

15651565

1566-
<pre><code><b>public</b> <b>fun</b> <a href="market_types.md#0x7_market_types_settle_trade">settle_trade</a>&lt;M: <b>copy</b>, drop, store, R: <b>copy</b>, drop, store&gt;(self: &<a href="market_types.md#0x7_market_types_MarketClearinghouseCallbacks">market_types::MarketClearinghouseCallbacks</a>&lt;M, R&gt;, market: &<b>mut</b> <a href="market_types.md#0x7_market_types_Market">market_types::Market</a>&lt;M&gt;, taker: <a href="market_clearinghouse_order_info.md#0x7_market_clearinghouse_order_info_MarketClearinghouseOrderInfo">market_clearinghouse_order_info::MarketClearinghouseOrderInfo</a>&lt;M&gt;, maker: <a href="market_clearinghouse_order_info.md#0x7_market_clearinghouse_order_info_MarketClearinghouseOrderInfo">market_clearinghouse_order_info::MarketClearinghouseOrderInfo</a>&lt;M&gt;, fill_id: u64, settled_price: u64, settled_size: u64): <a href="market_types.md#0x7_market_types_SettleTradeResult">market_types::SettleTradeResult</a>&lt;R&gt;
1566+
<pre><code>#[lint::skip(#[needless_mutable_reference])]
1567+
<b>public</b> <b>fun</b> <a href="market_types.md#0x7_market_types_settle_trade">settle_trade</a>&lt;M: <b>copy</b>, drop, store, R: <b>copy</b>, drop, store&gt;(self: &<a href="market_types.md#0x7_market_types_MarketClearinghouseCallbacks">market_types::MarketClearinghouseCallbacks</a>&lt;M, R&gt;, market: &<b>mut</b> <a href="market_types.md#0x7_market_types_Market">market_types::Market</a>&lt;M&gt;, taker: <a href="market_clearinghouse_order_info.md#0x7_market_clearinghouse_order_info_MarketClearinghouseOrderInfo">market_clearinghouse_order_info::MarketClearinghouseOrderInfo</a>&lt;M&gt;, maker: <a href="market_clearinghouse_order_info.md#0x7_market_clearinghouse_order_info_MarketClearinghouseOrderInfo">market_clearinghouse_order_info::MarketClearinghouseOrderInfo</a>&lt;M&gt;, fill_id: u64, settled_price: u64, settled_size: u64): <a href="market_types.md#0x7_market_types_SettleTradeResult">market_types::SettleTradeResult</a>&lt;R&gt;
15671568
</code></pre>
15681569

15691570

aptos-move/framework/aptos-experimental/doc/order_operations.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,10 @@ Parameters:
277277

278278
## Function `cancel_single_order_helper`
279279

280-
Internal helper function to cancel a single order.
281-
This function handles the cleanup and event emission for order cancellation.
282-
283-
Parameters:
284-
- market: The market instance
285-
- order: The order to cancel
286-
- callbacks: The market clearinghouse callbacks for cleanup operations
287280

288281

289-
<pre><code><b>fun</b> <a href="order_operations.md#0x7_order_operations_cancel_single_order_helper">cancel_single_order_helper</a>&lt;M: <b>copy</b>, drop, store, R: <b>copy</b>, drop, store&gt;(market: &<b>mut</b> <a href="market_types.md#0x7_market_types_Market">market_types::Market</a>&lt;M&gt;, order: <a href="single_order_types.md#0x7_single_order_types_SingleOrder">single_order_types::SingleOrder</a>&lt;M&gt;, emit_event: bool, callbacks: &<a href="market_types.md#0x7_market_types_MarketClearinghouseCallbacks">market_types::MarketClearinghouseCallbacks</a>&lt;M, R&gt;)
282+
<pre><code>#[lint::skip(#[needless_mutable_reference])]
283+
<b>fun</b> <a href="order_operations.md#0x7_order_operations_cancel_single_order_helper">cancel_single_order_helper</a>&lt;M: <b>copy</b>, drop, store, R: <b>copy</b>, drop, store&gt;(market: &<b>mut</b> <a href="market_types.md#0x7_market_types_Market">market_types::Market</a>&lt;M&gt;, order: <a href="single_order_types.md#0x7_single_order_types_SingleOrder">single_order_types::SingleOrder</a>&lt;M&gt;, emit_event: bool, callbacks: &<a href="market_types.md#0x7_market_types_MarketClearinghouseCallbacks">market_types::MarketClearinghouseCallbacks</a>&lt;M, R&gt;)
290284
</code></pre>
291285

292286

aptos-move/framework/aptos-experimental/doc/order_placement.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,8 @@ Places a market order - The order is guaranteed to be a taker order and will be
10161016

10171017

10181018

1019-
<pre><code><b>fun</b> <a href="order_placement.md#0x7_order_placement_cancel_single_order_internal">cancel_single_order_internal</a>&lt;M: <b>copy</b>, drop, store, R: <b>copy</b>, drop, store&gt;(market: &<b>mut</b> <a href="market_types.md#0x7_market_types_Market">market_types::Market</a>&lt;M&gt;, user_addr: <b>address</b>, limit_price: u64, order_id: <a href="order_book_types.md#0x7_order_book_types_OrderIdType">order_book_types::OrderIdType</a>, client_order_id: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_Option">option::Option</a>&lt;<a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/string.md#0x1_string_String">string::String</a>&gt;, orig_size: u64, size_delta: u64, fill_sizes: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, match_count: u32, is_bid: bool, is_taker: bool, cancel_reason: <a href="order_placement.md#0x7_order_placement_OrderCancellationReason">order_placement::OrderCancellationReason</a>, cancel_details: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/string.md#0x1_string_String">string::String</a>, metadata: M, time_in_force: <a href="order_book_types.md#0x7_order_book_types_TimeInForce">order_book_types::TimeInForce</a>, callbacks: &<a href="market_types.md#0x7_market_types_MarketClearinghouseCallbacks">market_types::MarketClearinghouseCallbacks</a>&lt;M, R&gt;, callback_results: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;R&gt;): <a href="order_placement.md#0x7_order_placement_OrderMatchResult">order_placement::OrderMatchResult</a>&lt;R&gt;
1019+
<pre><code>#[lint::skip(#[needless_mutable_reference])]
1020+
<b>fun</b> <a href="order_placement.md#0x7_order_placement_cancel_single_order_internal">cancel_single_order_internal</a>&lt;M: <b>copy</b>, drop, store, R: <b>copy</b>, drop, store&gt;(market: &<b>mut</b> <a href="market_types.md#0x7_market_types_Market">market_types::Market</a>&lt;M&gt;, user_addr: <b>address</b>, limit_price: u64, order_id: <a href="order_book_types.md#0x7_order_book_types_OrderIdType">order_book_types::OrderIdType</a>, client_order_id: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_Option">option::Option</a>&lt;<a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/string.md#0x1_string_String">string::String</a>&gt;, orig_size: u64, size_delta: u64, fill_sizes: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, match_count: u32, is_bid: bool, is_taker: bool, cancel_reason: <a href="order_placement.md#0x7_order_placement_OrderCancellationReason">order_placement::OrderCancellationReason</a>, cancel_details: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/string.md#0x1_string_String">string::String</a>, metadata: M, time_in_force: <a href="order_book_types.md#0x7_order_book_types_TimeInForce">order_book_types::TimeInForce</a>, callbacks: &<a href="market_types.md#0x7_market_types_MarketClearinghouseCallbacks">market_types::MarketClearinghouseCallbacks</a>&lt;M, R&gt;, callback_results: <a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;R&gt;): <a href="order_placement.md#0x7_order_placement_OrderMatchResult">order_placement::OrderMatchResult</a>&lt;R&gt;
10201021
</code></pre>
10211022

10221023

aptos-move/framework/aptos-experimental/doc/veiled_coin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ Given an address <code>addr</code>, returns the ElGamal encryption public key as
10541054
<a href="../../aptos-framework/../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_not_found">error::not_found</a>(<a href="veiled_coin.md#0x7_veiled_coin_EVEILED_COIN_STORE_NOT_PUBLISHED">EVEILED_COIN_STORE_NOT_PUBLISHED</a>)
10551055
);
10561056
1057-
<b>borrow_global_mut</b>&lt;<a href="veiled_coin.md#0x7_veiled_coin_VeiledCoinStore">VeiledCoinStore</a>&lt;CoinType&gt;&gt;(addr).pk
1057+
<b>borrow_global</b>&lt;<a href="veiled_coin.md#0x7_veiled_coin_VeiledCoinStore">VeiledCoinStore</a>&lt;CoinType&gt;&gt;(addr).pk
10581058
}
10591059
</code></pre>
10601060

aptos-move/framework/aptos-experimental/sources/confidential_asset/confidential_asset.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ module aptos_experimental::confidential_asset {
642642
error::not_found(ECA_STORE_NOT_PUBLISHED)
643643
);
644644

645-
borrow_global_mut<ConfidentialAssetStore>(get_user_address(user, token)).ek
645+
borrow_global<ConfidentialAssetStore>(get_user_address(user, token)).ek
646646
}
647647

648648
#[view]

aptos-move/framework/aptos-experimental/sources/trading/market/market_types.move

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ module aptos_experimental::market_types {
225225
CallbackResult::NOT_AVAILABLE
226226
}
227227

228+
#[lint::skip(needless_mutable_reference)]
228229
public fun settle_trade<M: store + copy + drop, R: store + copy + drop>(
229230
self: &MarketClearinghouseCallbacks<M, R>,
230231
market: &mut Market<M>,

aptos-move/framework/aptos-experimental/sources/trading/market/order_operations.move

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,14 @@ module aptos_experimental::order_operations {
164164
);
165165
}
166166

167-
/// Internal helper function to cancel a single order.
168-
/// This function handles the cleanup and event emission for order cancellation.
169-
///
170-
/// Parameters:
171-
/// - market: The market instance
172-
/// - order: The order to cancel
173-
/// - callbacks: The market clearinghouse callbacks for cleanup operations
167+
#[lint::skip(needless_mutable_reference)]
168+
// Internal helper function to cancel a single order.
169+
// This function handles the cleanup and event emission for order cancellation.
170+
//
171+
// Parameters:
172+
// - market: The market instance
173+
// - order: The order to cancel
174+
// - callbacks: The market clearinghouse callbacks for cleanup operations
174175
fun cancel_single_order_helper<M: store + copy + drop, R: store + copy + drop>(
175176
market: &mut Market<M>,
176177
order: SingleOrder<M>,

aptos-move/framework/aptos-experimental/sources/trading/market/order_placement.move

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module aptos_experimental::order_placement {
7171
Self,
7272
MarketClearinghouseCallbacks,
7373
Market, CallbackResult, new_callback_result_not_available,
74-
is_validation_result_valid, get_validation_cancellation_reason,
74+
is_validation_result_valid,
7575
};
7676

7777
// Error codes
@@ -428,6 +428,7 @@ module aptos_experimental::order_placement {
428428
);
429429
}
430430

431+
#[lint::skip(needless_mutable_reference)]
431432
fun cancel_single_order_internal<M: store + copy + drop, R: store + copy + drop>(
432433
market: &mut Market<M>,
433434
user_addr: address,

0 commit comments

Comments
 (0)