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

Fix duplicated warning for rand::Rng::gen_ascii_chars #1042

Merged
merged 1 commit into from
Sep 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/actions/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};

use log::debug;
use rand::{thread_rng, Rng};
use rand::{distributions, thread_rng, Rng};
use rustfmt_nightly::{Config, Input, Session};
use serde_json;

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

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

Ok(File::create(&path)
Expand Down