Skip to content

Commit 3871ba9

Browse files
committed
Switch to Rust-1.66 (#869)
1 parent 68426cc commit 3871ba9

File tree

11 files changed

+25
-31
lines changed

11 files changed

+25
-31
lines changed

.github/workflows/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Install toolchain
3535
uses: dtolnay/rust-toolchain@nightly
3636
with:
37-
toolchain: nightly-2022-08-05
37+
toolchain: nightly-2022-10-30
3838
components: rustfmt
3939
target: wasm32-unknown-unknown
4040
- name: Generate code coverage

.github/workflows/master.yml.disabled

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install toolchain
1616
uses: dtolnay/rust-toolchain@nightly
1717
with:
18-
toolchain: nightly-2022-08-05
18+
toolchain: nightly-2022-10-30
1919
- name: Install cargo-unleash
2020
run: cargo install cargo-unleash --git https://github.com/xlc/cargo-unleash.git # https://github.com/paritytech/cargo-unleash/pull/38
2121
- name: Prepare

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Install toolchain
3535
uses: dtolnay/rust-toolchain@nightly
3636
with:
37-
toolchain: nightly-2022-08-05
37+
toolchain: nightly-2022-10-30
3838
components: rustfmt
3939
target: wasm32-unknown-unknown
4040
- name: Install Wasm toolchain

asset-registry/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl<T: Config> Pallet<T> {
313313
fn do_insert_location(asset_id: T::AssetId, location: VersionedMultiLocation) -> DispatchResult {
314314
// if the metadata contains a location, set the LocationToAssetId
315315
let location: MultiLocation = location.try_into().map_err(|()| Error::<T>::BadVersion)?;
316-
LocationToAssetId::<T>::try_mutate(&location, |maybe_asset_id| {
316+
LocationToAssetId::<T>::try_mutate(location, |maybe_asset_id| {
317317
ensure!(maybe_asset_id.is_none(), Error::<T>::ConflictingLocation);
318318
*maybe_asset_id = Some(asset_id);
319319
Ok(())

auction/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ pub mod module {
109109
#[pallet::hooks]
110110
impl<T: Config> Hooks<T::BlockNumber> for Pallet<T> {
111111
fn on_initialize(now: T::BlockNumber) -> Weight {
112-
T::WeightInfo::on_finalize(AuctionEndTime::<T>::iter_prefix(&now).count() as u32)
112+
T::WeightInfo::on_finalize(AuctionEndTime::<T>::iter_prefix(now).count() as u32)
113113
}
114114

115115
fn on_finalize(now: T::BlockNumber) {
116-
for (auction_id, _) in AuctionEndTime::<T>::drain_prefix(&now) {
117-
if let Some(auction) = Auctions::<T>::take(&auction_id) {
116+
for (auction_id, _) in AuctionEndTime::<T>::drain_prefix(now) {
117+
if let Some(auction) = Auctions::<T>::take(auction_id) {
118118
T::Handler::on_auction_ended(auction_id, auction.bid);
119119
}
120120
}
@@ -151,10 +151,10 @@ pub mod module {
151151
match bid_result.auction_end_change {
152152
Change::NewValue(new_end) => {
153153
if let Some(old_end_block) = auction.end {
154-
AuctionEndTime::<T>::remove(&old_end_block, id);
154+
AuctionEndTime::<T>::remove(old_end_block, id);
155155
}
156156
if let Some(new_end_block) = new_end {
157-
AuctionEndTime::<T>::insert(&new_end_block, id, ());
157+
AuctionEndTime::<T>::insert(new_end_block, id, ());
158158
}
159159
auction.end = new_end;
160160
}
@@ -189,10 +189,10 @@ impl<T: Config> Auction<T::AccountId, T::BlockNumber> for Pallet<T> {
189189
) -> DispatchResult {
190190
let auction = Auctions::<T>::get(id).ok_or(Error::<T>::AuctionNotExist)?;
191191
if let Some(old_end) = auction.end {
192-
AuctionEndTime::<T>::remove(&old_end, id);
192+
AuctionEndTime::<T>::remove(old_end, id);
193193
}
194194
if let Some(new_end) = info.end {
195-
AuctionEndTime::<T>::insert(&new_end, id, ());
195+
AuctionEndTime::<T>::insert(new_end, id, ());
196196
}
197197
Auctions::<T>::insert(id, info);
198198
Ok(())
@@ -211,14 +211,14 @@ impl<T: Config> Auction<T::AccountId, T::BlockNumber> for Pallet<T> {
211211
})?;
212212
Auctions::<T>::insert(auction_id, auction);
213213
if let Some(end_block) = end {
214-
AuctionEndTime::<T>::insert(&end_block, auction_id, ());
214+
AuctionEndTime::<T>::insert(end_block, auction_id, ());
215215
}
216216

217217
Ok(auction_id)
218218
}
219219

220220
fn remove_auction(id: Self::AuctionId) {
221-
if let Some(auction) = Auctions::<T>::take(&id) {
221+
if let Some(auction) = Auctions::<T>::take(id) {
222222
if let Some(end_block) = auction.end {
223223
AuctionEndTime::<T>::remove(end_block, id);
224224
}

bencher/src/build_wasm/prerequisites.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ fn get_rustup_nightly(selected: Option<String>) -> Option<CargoCommand> {
7777
let version = match selected {
7878
Some(selected) => selected,
7979
None => {
80-
let output = Command::new("rustup")
81-
.args(&["toolchain", "list"])
82-
.output()
83-
.ok()?
84-
.stdout;
80+
let output = Command::new("rustup").args(["toolchain", "list"]).output().ok()?.stdout;
8581
let lines = output.as_slice().lines();
8682

8783
let mut latest_nightly = None;
@@ -194,7 +190,7 @@ fn create_check_toolchain_project(project_dir: &Path) {
194190
let manifest_path = project_dir.join("Cargo.toml");
195191

196192
write_file_if_changed(
197-
&manifest_path,
193+
manifest_path,
198194
r#"
199195
[package]
200196
name = "wasm-test"
@@ -260,7 +256,7 @@ fn check_wasm_toolchain_installed(cargo_command: CargoCommand) -> Result<CargoCo
260256
let manifest_path = temp.path().join("Cargo.toml").display().to_string();
261257

262258
let mut build_cmd = cargo_command.command();
263-
build_cmd.args(&[
259+
build_cmd.args([
264260
"build",
265261
"--target=wasm32-unknown-unknown",
266262
"--manifest-path",
@@ -272,7 +268,7 @@ fn check_wasm_toolchain_installed(cargo_command: CargoCommand) -> Result<CargoCo
272268
}
273269

274270
let mut run_cmd = cargo_command.command();
275-
run_cmd.args(&["run", "--manifest-path", &manifest_path]);
271+
run_cmd.args(["run", "--manifest-path", &manifest_path]);
276272

277273
build_cmd.output().map_err(|_| err_msg.clone()).and_then(|s| {
278274
if s.status.success() {

bencher/src/build_wasm/wasm_project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ fn build_project(project: &Path, default_rustflags: &str, cargo_cmd: CargoComman
428428
);
429429

430430
build_cmd
431-
.args(&["rustc", "--target=wasm32-unknown-unknown"])
431+
.args(["rustc", "--target=wasm32-unknown-unknown"])
432432
.arg(format!("--manifest-path={}", manifest_path.display()))
433433
.env("RUSTFLAGS", rustflags)
434434
// Unset the `CARGO_TARGET_DIR` to prevent a cargo deadlock (cargo locks a target dir exclusive).

oracle/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
215215
value: value.clone(),
216216
timestamp: now,
217217
};
218-
RawValues::<T, I>::insert(&who, &key, timestamped);
218+
RawValues::<T, I>::insert(&who, key, timestamped);
219219

220220
// Update `Values` storage if `combined` yielded result.
221221
if let Some(combined) = Self::combined(key) {

vesting/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ pub mod module {
245245
#[pallet::call]
246246
impl<T: Config> Pallet<T> {
247247
#[pallet::call_index(0)]
248-
#[pallet::weight(T::WeightInfo::claim((<T as Config>::MaxVestingSchedules::get() / 2) as u32))]
248+
#[pallet::weight(T::WeightInfo::claim(<T as Config>::MaxVestingSchedules::get() / 2))]
249249
pub fn claim(origin: OriginFor<T>) -> DispatchResult {
250250
let who = ensure_signed(origin)?;
251251
let locked_amount = Self::do_claim(&who);
@@ -301,7 +301,7 @@ pub mod module {
301301
}
302302

303303
#[pallet::call_index(3)]
304-
#[pallet::weight(T::WeightInfo::claim((<T as Config>::MaxVestingSchedules::get() / 2) as u32))]
304+
#[pallet::weight(T::WeightInfo::claim(<T as Config>::MaxVestingSchedules::get() / 2))]
305305
pub fn claim_for(origin: OriginFor<T>, dest: <T::Lookup as StaticLookup>::Source) -> DispatchResult {
306306
let _ = ensure_signed(origin)?;
307307
let who = T::Lookup::lookup(dest)?;

weight-gen/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn main() {
162162
// Use empty header if a header path is not given.
163163
let header = {
164164
if let Some(path) = matches.get_one::<String>("header") {
165-
::std::fs::read_to_string(&path).expect("Header file not found")
165+
::std::fs::read_to_string(path).expect("Header file not found")
166166
} else {
167167
String::from("")
168168
}
@@ -175,15 +175,15 @@ fn main() {
175175
// Use default template if template path is not given.
176176
let template = {
177177
if let Some(path) = matches.get_one::<String>("template") {
178-
::std::fs::read_to_string(&path).expect("Template file not found")
178+
::std::fs::read_to_string(path).expect("Template file not found")
179179
} else {
180180
String::from(DEFAULT_TEMPLATE)
181181
}
182182
};
183183

184184
// Write benchmark to file or print to terminal if output path is not given.
185185
if let Some(path) = matches.get_one::<String>("output") {
186-
let mut output_file = ::std::fs::File::create(&path).expect("Could not create output file");
186+
let mut output_file = ::std::fs::File::create(path).expect("Could not create output file");
187187

188188
handlebars
189189
.render_template_to_write(&template, &hbs_data, &mut output_file)

xtokens/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,8 @@ pub mod module {
924924
fn get_reserve_location(assets: &MultiAssets, fee_item: &u32) -> Option<MultiLocation> {
925925
let reserve_idx = if assets.len() == 1 {
926926
0
927-
} else if *fee_item == 0 {
928-
1
929927
} else {
930-
0
928+
(*fee_item == 0) as usize
931929
};
932930
let asset = assets.get(reserve_idx);
933931
asset.and_then(T::ReserveProvider::reserve)

0 commit comments

Comments
 (0)