Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 9b7352b

Browse files
authored
Merge pull request #1042 from kngwyu/fix-warn
Fix duplicated warning for rand::Rng::gen_ascii_chars
2 parents 4b61cf0 + b1d8171 commit 9b7352b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/actions/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::path::{Path, PathBuf};
1818
use std::process::{Command, Stdio};
1919

2020
use log::debug;
21-
use rand::{thread_rng, Rng};
21+
use rand::{distributions, thread_rng, Rng};
2222
use rustfmt_nightly::{Config, Input, Session};
2323
use serde_json;
2424

@@ -117,7 +117,7 @@ fn format_internal(input: String, config: Config) -> Result<String, String> {
117117
fn random_file() -> Result<(File, PathBuf), String> {
118118
const SUFFIX_LEN: usize = 10;
119119

120-
let suffix: String = thread_rng().gen_ascii_chars().take(SUFFIX_LEN).collect();
120+
let suffix: String = thread_rng().sample_iter(&distributions::Alphanumeric).take(SUFFIX_LEN).collect();
121121
let path = temp_dir().join(suffix);
122122

123123
Ok(File::create(&path)

0 commit comments

Comments
 (0)