Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated gen_ascii_chars() with sample_iter(&Alphanumeric) #5655

Merged
merged 1 commit into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions components/sup/src/manager/service/composite_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use hcore::package::{Identifiable, PackageIdent, PackageInstall};
use hcore::util::{deserialize_using_from_str, serialize_using_to_string};

use error::{Error, Result, SupError};
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use toml;

Expand Down Expand Up @@ -127,9 +128,12 @@ impl CompositeSpec {
.as_ref()
.parent()
.expect("Cannot determine parent directory for composite spec");
let tmpfile = path
.as_ref()
.with_extension(thread_rng().gen_ascii_chars().take(8).collect::<String>());
let tmpfile = path.as_ref().with_extension(
thread_rng()
.sample_iter(&Alphanumeric)
.take(8)
.collect::<String>(),
);
fs::create_dir_all(dst_path).map_err(|err| {
sup_error!(Error::ServiceSpecFileIO(path.as_ref().to_path_buf(), err))
})?;
Expand Down
10 changes: 7 additions & 3 deletions components/sup/src/manager/service/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use hcore::service::{ApplicationEnvironment, ServiceGroup};
use hcore::url::DEFAULT_BLDR_URL;
use hcore::util::{deserialize_using_from_str, serialize_using_to_string};
use protocol;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use serde::{self, Deserialize};
use toml;
Expand Down Expand Up @@ -315,9 +316,12 @@ impl ServiceSpec {
.as_ref()
.parent()
.expect("Cannot determine parent directory for service spec");
let tmpfile = path
.as_ref()
.with_extension(thread_rng().gen_ascii_chars().take(8).collect::<String>());
let tmpfile = path.as_ref().with_extension(
thread_rng()
.sample_iter(&Alphanumeric)
.take(8)
.collect::<String>(),
);
fs::create_dir_all(dst_path).map_err(|err| {
sup_error!(Error::ServiceSpecFileIO(path.as_ref().to_path_buf(), err))
})?;
Expand Down