Skip to content

Commit d219c0c

Browse files
chore: update rand to 0.9.0 (#790)
1 parent ed0be2b commit d219c0c

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ percent-encoding = "2.2.0"
105105
portable-pty = "0.8.1"
106106
r2d2 = "0.8.10"
107107
r2d2_sqlite = "0.25.0"
108-
rand = "0.8.5"
108+
rand = "0.9.0"
109109
regex = "1.7.0"
110110
reqwest = { version = "0.12.12", default-features = false, features = [
111111
# defaults except tls

crates/fig_auth/src/pkce.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ impl PkceRegistration {
188188
let redirect_uri = format!("http://{}/oauth/callback", listener.local_addr()?);
189189
let code_verifier = generate_code_verifier();
190190
let code_challenge = generate_code_challenge(&code_verifier);
191-
let state = rand::thread_rng()
192-
.sample_iter(rand::distributions::Alphanumeric)
191+
let state = rand::rng()
192+
.sample_iter(rand::distr::Alphanumeric)
193193
.take(10)
194194
.collect::<Vec<_>>();
195195
let state = String::from_utf8(state).unwrap_or("state".to_string());

crates/fig_proto/src/mux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ pub struct PacketOptions {
3333
pub fn message_to_packet<M: Message>(message: M, options: &PacketOptions) -> Result<Packet, MuxError> {
3434
let mut inner = message.encode_to_vec();
3535

36-
let mut rng = rand::thread_rng();
37-
let nonce_length = rng.gen_range(16..=32);
36+
let mut rng = rand::rng();
37+
let nonce_length = rng.random_range(16..=32);
3838
let mut nonce = vec![0; nonce_length];
3939
rng.fill_bytes(&mut nonce);
4040

crates/fig_util/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl std::fmt::Display for UnknownDesktopErrContext {
8484
/// ```
8585
pub fn gen_hex_string() -> String {
8686
let mut buf = [0u8; 32];
87-
rand::thread_rng().fill(&mut buf);
87+
rand::rng().fill(&mut buf);
8888
hex::encode(buf)
8989
}
9090

crates/q_cli/src/cli/chat/conversation_state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ use fig_api_client::model::{
1919
UserInputMessageContext,
2020
};
2121
use fig_util::Shell;
22-
use rand::distributions::{
22+
use rand::distr::{
2323
Alphanumeric,
24-
DistString,
24+
SampleString,
2525
};
2626
use tracing::{
2727
debug,
@@ -61,7 +61,7 @@ pub struct ConversationState {
6161

6262
impl ConversationState {
6363
pub fn new(tool_config: HashMap<String, ToolSpec>) -> Self {
64-
let conversation_id = Alphanumeric.sample_string(&mut rand::thread_rng(), 9);
64+
let conversation_id = Alphanumeric.sample_string(&mut rand::rng(), 9);
6565
info!(?conversation_id, "Generated new conversation id");
6666
Self {
6767
conversation_id,

crates/q_cli/src/cli/chat/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use fig_api_client::model::{
77
ChatResponseStream,
88
ToolUse as FigToolUse,
99
};
10-
use rand::distributions::{
10+
use rand::distr::{
1111
Alphanumeric,
12-
DistString,
12+
SampleString,
1313
};
1414
use thiserror::Error;
1515
use tracing::{
@@ -96,7 +96,7 @@ pub struct ResponseParser {
9696

9797
impl ResponseParser {
9898
pub fn new(response: SendMessageOutput) -> Self {
99-
let message_id = Alphanumeric.sample_string(&mut rand::thread_rng(), 9);
99+
let message_id = Alphanumeric.sample_string(&mut rand::rng(), 9);
100100
info!(?message_id, "Generated new message id");
101101
Self {
102102
response,

crates/q_cli/src/cli/internal/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ use fig_util::{
6969
directories,
7070
};
7171
use multiplexer::MultiplexerArgs;
72-
use rand::distributions::{
72+
use rand::distr::{
7373
Alphanumeric,
74-
DistString,
74+
SampleString,
7575
};
7676
use sysinfo::System;
7777
use tokio::io::{
@@ -350,7 +350,7 @@ impl InternalSubcommand {
350350
(filename, exit_code)
351351
},
352352
_ => {
353-
let file_id = Alphanumeric.sample_string(&mut rand::thread_rng(), 9);
353+
let file_id = Alphanumeric.sample_string(&mut rand::rng(), 9);
354354
let tmp_filename = format!("fig-callback-{file_id}");
355355
let tmp_path = PathBuf::from("/tmp").join(tmp_filename);
356356
let mut tmp_file = std::fs::File::create(&tmp_path)?;

crates/q_cli/src/cli/tweet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const TWEET_OPTIONS: &[(&str, bool)] = &[
2424
];
2525

2626
fn tweet_url() -> Result<Url> {
27-
let mut rng = rand::thread_rng();
27+
let mut rng = rand::rng();
2828
let (tweet, with_link) = TWEET_OPTIONS.choose(&mut rng).unwrap_or(&TWEET_OPTIONS[0]);
2929

3030
let mut params = vec![("text", *tweet), ("related", "codewhisperer")];

0 commit comments

Comments
 (0)