Skip to content

Commit 80c39c8

Browse files
authored
chore: update toolchain version (#56)
* chore: update toolchain version Updates toolchain to nightly-2022-11-03 to match that used by the main tari repo. * fix: fix clippy errors The new toolchain introduced some clippy errors that needed to be fixed before the CI process would accept the changes. * fix: remove invalid config options ..from rustfmt.toml report_xxx aren't supported anymore * fix: run cargo fmt
1 parent 39be3ea commit 80c39c8

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: toolchain
1515
uses: actions-rs/toolchain@v1
1616
with:
17-
toolchain: nightly-2021-11-20
17+
toolchain: nightly-2022-11-03
1818
profile: minimal
1919
components: rustfmt, clippy
2020
override: true

build.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
let build_dir = &project_dir.join("randomx_build");
3838

3939
env::set_current_dir(Path::new(&repo_dir)).unwrap(); // change current path to repo for dependency build
40-
match fs::create_dir_all(&build_dir) {
40+
match fs::create_dir_all(build_dir) {
4141
Ok(_) => (),
4242
Err(e) => match e.kind() {
4343
ErrorKind::AlreadyExists => (),
@@ -124,10 +124,9 @@ fn main() {
124124
let android_sdk = env::var("ANDROID_SDK_ROOT").expect("ANDROID_SDK_ROOT variable not set");
125125

126126
let android_platform = env::var("ANDROID_PLATFORM").unwrap_or_else(|_| "android-26".to_owned());
127-
let android_cmake =
128-
env::var("ANDROID_CMAKE").unwrap_or(android_sdk.clone() + &"/cmake/3.22.1/bin/cmake".to_owned());
127+
let android_cmake = env::var("ANDROID_CMAKE").unwrap_or(android_sdk.clone() + "/cmake/3.22.1/bin/cmake");
129128
let android_toolchain = env::var("ANDROID_CMAKE_TOOLCHAIN")
130-
.unwrap_or(android_sdk + &"/ndk/22.1.7171670/build/cmake/android.toolchain.cmake".to_owned());
129+
.unwrap_or(android_sdk + "/ndk/22.1.7171670/build/cmake/android.toolchain.cmake");
131130

132131
let c = Command::new(android_cmake)
133132
.arg("-D")

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# this should match the nightly version in tari-project/tari
22
# only used for cargo fmt settings, repo should always compile on stable too
33
[toolchain]
4-
channel = "nightly-2021-11-20"
4+
channel = "nightly-2022-11-03"

rustfmt.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ normalize_comments = true
1313
reorder_imports = true
1414
reorder_modules = true
1515
reorder_impl_items = true
16-
report_todo = "Never"
17-
report_fixme = "Never"
1816
space_after_colon = true
1917
space_before_colon = false
2018
struct_lit_single_line = true

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl RandomXCache {
175175
let inner = RandomXCacheInner { cache_ptr: test };
176176
let result = RandomXCache { inner: Arc::new(inner) };
177177
let key_ptr = key.as_ptr() as *mut c_void;
178-
let key_size = key.len() as usize;
178+
let key_size = key.len();
179179
unsafe {
180180
randomx_init_cache(result.inner.cache_ptr, key_ptr, key_size);
181181
}
@@ -262,7 +262,7 @@ impl RandomXDataset {
262262
0 => Err(RandomXError::Other("Dataset item count was 0".to_string())),
263263
x => {
264264
// This weirdness brought to you by c_ulong being different on Windows and Linux
265-
Ok(u32::try_from(u64::from(x))?)
265+
Ok(u32::try_from(x)?)
266266
},
267267
}
268268
}
@@ -392,7 +392,7 @@ impl RandomXVM {
392392
if input.is_empty() {
393393
Err(RandomXError::ParameterError("input was empty".to_string()))
394394
} else {
395-
let size_input = input.len() as usize;
395+
let size_input = input.len();
396396
let input_ptr = input.as_ptr() as *mut c_void;
397397
let arr = [0; RANDOMX_HASH_SIZE as usize];
398398
let output_ptr = arr.as_ptr() as *mut c_void;
@@ -450,7 +450,7 @@ impl RandomXVM {
450450
}
451451
return Err(RandomXError::ParameterError("input was empty".to_string()));
452452
};
453-
let size_input = input[i].len() as usize;
453+
let size_input = input[i].len();
454454
let input_ptr = input[i].as_ptr() as *mut c_void;
455455
output_ptr = arr.as_ptr() as *mut c_void;
456456
if i == 0 {

0 commit comments

Comments
 (0)