Skip to content

Commit 0cca4f7

Browse files
committed
chore(*): switch back to nightly
1 parent 8b2982e commit 0cca4f7

File tree

13 files changed

+38
-109
lines changed

13 files changed

+38
-109
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
4141
build: >-
4242
set -e &&
43+
rustup target add x86_64-unknown-linux-gnu &&
4344
yarn lerna exec "yarn build --target x86_64-unknown-linux-gnu" --concurrency 1 --stream --no-prefix &&
4445
strip packages/*/*.node
4546
- host: ubuntu-latest
@@ -59,8 +60,9 @@ jobs:
5960
- host: ubuntu-latest
6061
target: aarch64-unknown-linux-gnu
6162
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
62-
build: |
63-
yarn lerna exec "yarn build --target aarch64-unknown-linux-gnu" --concurrency 1 --stream --no-prefix
63+
build: >-
64+
rustup target add aarch64-unknown-linux-gnu &&
65+
yarn lerna exec "yarn build --target aarch64-unknown-linux-gnu" --concurrency 1 --stream --no-prefix &&
6466
llvm-strip packages/*/*.node
6567
- host: ubuntu-latest
6668
target: 'armv7-unknown-linux-gnueabihf'
@@ -109,7 +111,7 @@ jobs:
109111
uses: dtolnay/rust-toolchain@stable
110112
if: ${{ !matrix.settings.docker }}
111113
with:
112-
toolchain: stable
114+
toolchain: nightly-2023-01-11
113115
targets: ${{ matrix.settings.target }}
114116

115117
- name: Cache cargo registry

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install
2424
uses: dtolnay/rust-toolchain@stable
2525
with:
26-
toolchain: stable
26+
toolchain: nightly-2023-01-11
2727
components: rustfmt, clippy
2828

2929
- name: 'Install dependencies'

packages/argon2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ global_alloc = { path = "../../crates/alloc" }
1313
napi-derive = { version = "2", default-features = false, features = [
1414
"type-def",
1515
] }
16-
rand = { version = "0.8", features = ["getrandom"] }
16+
rand = { version = "0.8", features = ["nightly", "simd_support", "getrandom"] }
1717

1818
[build-dependencies]
1919
napi-build = "2"

packages/argon2/src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ impl Task for HashTask {
124124
let salt = SaltString::generate(&mut OsRng);
125125
let hasher = self.options.to_argon();
126126
hasher
127-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?
127+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?
128128
.hash_password(self.password.as_slice(), &salt)
129-
.map_err(|err| Error::new(Status::GenericFailure, format!("{}", err)))
129+
.map_err(|err| Error::new(Status::GenericFailure, format!("{err}")))
130130
.map(|h| h.to_string())
131131
}
132132

@@ -185,7 +185,7 @@ impl Task for RawHashTask {
185185
let hasher = self
186186
.options
187187
.to_argon()
188-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?;
188+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?;
189189
let output_len = hasher
190190
.params()
191191
.output_len()
@@ -194,7 +194,7 @@ impl Task for RawHashTask {
194194

195195
hasher
196196
.hash_password_into(self.password.as_slice(), salt.as_bytes(), &mut output)
197-
.map_err(|err| Error::new(Status::GenericFailure, format!("{}", err)))
197+
.map_err(|err| Error::new(Status::GenericFailure, format!("{err}")))
198198
.map(|_| output)
199199
}
200200

@@ -251,11 +251,11 @@ impl Task for VerifyTask {
251251

252252
fn compute(&mut self) -> Result<Self::Output> {
253253
let parsed_hash = argon2::PasswordHash::new(self.hashed.as_str())
254-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?;
254+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?;
255255
let argon2 = self.options.to_argon();
256256
Ok(
257257
argon2
258-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?
258+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?
259259
.verify_password(self.password.as_bytes(), &parsed_hash)
260260
.is_ok(),
261261
)
@@ -278,12 +278,12 @@ pub fn verify(
278278
password: match password {
279279
Either::A(s) => s,
280280
Either::B(b) => String::from_utf8(b.to_vec())
281-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?,
281+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?,
282282
},
283283
hashed: match hashed {
284284
Either::A(s) => s,
285285
Either::B(b) => String::from_utf8(b.to_vec())
286-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?,
286+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?,
287287
},
288288
options: options.unwrap_or_default(),
289289
},
@@ -302,12 +302,12 @@ pub fn verify_sync(
302302
password: match password {
303303
Either::A(s) => s,
304304
Either::B(b) => String::from_utf8(b.to_vec())
305-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?,
305+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?,
306306
},
307307
hashed: match hashed {
308308
Either::A(s) => s,
309309
Either::B(b) => String::from_utf8(b.to_vec())
310-
.map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?,
310+
.map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?,
311311
},
312312
options: options.unwrap_or_default(),
313313
};

packages/bcrypt/src/hash_task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl HashTask {
4444
pub fn hash(buf: &[u8], salt: [u8; 16], cost: u32) -> Result<String> {
4545
bcrypt::hash_with_salt(buf, cost, salt)
4646
.map(|hash_part| hash_part.to_string())
47-
.map_err(|err| Error::new(Status::GenericFailure, format!("{}", err)))
47+
.map_err(|err| Error::new(Status::GenericFailure, format!("{err}")))
4848
}
4949
}
5050

packages/bcrypt/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn gen_salt_sync(round: u32, version: String) -> Result<String> {
2626
let salt = gen_salt().map_err(|err| {
2727
Error::new(
2828
Status::GenericFailure,
29-
format!("Generate salt failed {}", err),
29+
format!("Generate salt failed {err}"),
3030
)
3131
})?;
3232
Ok(format_salt(
@@ -60,7 +60,7 @@ pub fn hash_sync(
6060
s.copy_from_slice(salt.as_ref());
6161
s
6262
} else {
63-
gen_salt().map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?
63+
gen_salt().map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?
6464
};
6565
match input {
6666
Either::A(s) => HashTask::hash(s.as_bytes(), salt, cost.unwrap_or(DEFAULT_COST)),
@@ -80,7 +80,7 @@ pub fn hash(
8080
s.copy_from_slice(salt.as_ref());
8181
s
8282
} else {
83-
gen_salt().map_err(|err| Error::new(Status::InvalidArg, format!("{}", err)))?
83+
gen_salt().map_err(|err| Error::new(Status::InvalidArg, format!("{err}")))?
8484
};
8585
let task = HashTask::new(
8686
AsyncHashInput::from_either(input)?,
@@ -127,7 +127,7 @@ fn version_from_str(version: &str) -> Result<Version> {
127127
"2x" => Ok(Version::TwoY),
128128
_ => Err(Error::new(
129129
Status::InvalidArg,
130-
format!("{} is not a valid version", version),
130+
format!("{version} is not a valid version"),
131131
)),
132132
}
133133
}

packages/bcrypt/src/salt_task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) fn format_salt(rounds: u32, version: &Version, salt: &[u8; 16]) -> St
2424
base64::engine::fast_portable::PAD,
2525
),
2626
);
27-
format!("${}${:0>2}${}", version, rounds, base64_string)
27+
format!("${version}${rounds:0>2}${base64_string}")
2828
}
2929

3030
pub struct SaltTask {
@@ -41,7 +41,7 @@ impl Task for SaltTask {
4141
let random = gen_salt().map_err(|err| {
4242
Error::new(
4343
Status::GenericFailure,
44-
format!("Generate salt failed {}", err),
44+
format!("Generate salt failed {err}"),
4545
)
4646
})?;
4747
Ok(format_salt(self.round, &self.version, &random))

packages/crc32/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["cdylib"]
99

1010
[dependencies]
1111
crc32c = { version = "0.6" }
12-
crc32fast = { version = "1.3" }
12+
crc32fast = { version = "1.3", features = ["nightly"] }
1313
global_alloc = { path = "../../crates/alloc" }
1414
napi = { version = "2", default-features = false, features = ["napi3"] }
1515
napi-derive = { version = "2", default-features = false }

packages/crc32/build.rs

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,5 @@
11
extern crate napi_build;
22

3-
use std::env;
4-
use std::fs::File;
5-
use std::io::{self, Write};
6-
use std::path::{Path, PathBuf};
7-
8-
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
9-
10-
const CASTAGNOLI_POLY: u32 = 0x82f63b78;
11-
12-
fn main() -> Result<()> {
3+
fn main() {
134
napi_build::setup();
14-
15-
let out_dir = match env::var_os("OUT_DIR") {
16-
None => return Err(From::from("OUT_DIR environment variable not defined")),
17-
Some(out_dir) => PathBuf::from(out_dir),
18-
};
19-
write_crc_tables(&out_dir)?;
20-
21-
Ok(())
22-
}
23-
24-
fn write_crc_tables(out_dir: &Path) -> Result<()> {
25-
let out_path = out_dir.join("crc32_table.rs");
26-
let mut out = io::BufWriter::new(File::create(out_path)?);
27-
28-
let table = make_table(CASTAGNOLI_POLY);
29-
let table16 = make_table16(CASTAGNOLI_POLY);
30-
31-
writeln!(out, "pub const TABLE: [u32; 256] = [")?;
32-
for &x in table.iter() {
33-
writeln!(out, " {},", x)?;
34-
}
35-
writeln!(out, "];\n")?;
36-
37-
writeln!(out, "pub const TABLE16: [[u32; 256]; 16] = [")?;
38-
for table in table16.iter() {
39-
writeln!(out, " [")?;
40-
for &x in table.iter() {
41-
writeln!(out, " {},", x)?;
42-
}
43-
writeln!(out, " ],")?;
44-
}
45-
writeln!(out, "];")?;
46-
47-
out.flush()?;
48-
49-
Ok(())
50-
}
51-
52-
fn make_table16(poly: u32) -> [[u32; 256]; 16] {
53-
let mut tab = [[0; 256]; 16];
54-
tab[0] = make_table(poly);
55-
for i in 0..256 {
56-
let mut crc = tab[0][i];
57-
for j in 1..16 {
58-
crc = (crc >> 8) ^ tab[0][crc as u8 as usize];
59-
tab[j][i] = crc;
60-
}
61-
}
62-
tab
63-
}
64-
65-
fn make_table(poly: u32) -> [u32; 256] {
66-
let mut tab = [0; 256];
67-
for i in 0u32..256u32 {
68-
let mut crc = i;
69-
for _ in 0..8 {
70-
if crc & 1 == 1 {
71-
crc = (crc >> 1) ^ poly;
72-
} else {
73-
crc >>= 1;
74-
}
75-
}
76-
tab[i as usize] = crc;
77-
}
78-
tab
795
}

packages/deno-lint/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
export function lint(
77
fileName: string,
88
sourceCode: string | Buffer,
9-
allRules?: boolean | string | undefined | null
9+
allRules?: boolean | string | undefined | null,
1010
): Array<string>
1111
export function denolint(dirname: string, configPath: string): boolean

0 commit comments

Comments
 (0)