Commit 06c83ba8 authored by Ben Boeckel's avatar Ben Boeckel

rust: prefer Into<String> over ToString

parent 715408c5
Pipeline #148321 failed with stage
......@@ -11,6 +11,7 @@
* `error-chain` is no longer used. Instead, custom error types are used. This
means that errors from this crate no longer allocate (except where a
`String` needs to be stored for messaging purposes).
* `Into<String>` is used for `CommitId` and `Identity` construction methods.
# v3.1.2
......
......@@ -128,8 +128,8 @@ pub(crate) type GitResult<T> = Result<T, GitError>;
impl CommitId {
/// Create a new `CommitId`.
pub fn new<I: ToString>(id: I) -> Self {
CommitId(id.to_string())
pub fn new<I: Into<String>>(id: I) -> Self {
CommitId(id.into())
}
/// The commit as a string reference.
......@@ -166,12 +166,12 @@ impl Identity {
/// Create a new identity.
pub fn new<N, E>(name: N, email: E) -> Self
where
N: ToString,
E: ToString,
N: Into<String>,
E: Into<String>,
{
Self {
name: name.to_string(),
email: email.to_string(),
name: name.into(),
email: email.into(),
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment