Commit 3a55a767 authored by Ben Boeckel's avatar Ben Boeckel

rust: remove internal uses of ToString

parent bd875060
......@@ -46,6 +46,6 @@ impl Error {
.and_then(|s| s.as_str())
.unwrap_or_else(|| "unknown error");
Error::from_kind(ErrorKind::Gitlab(msg.to_string()))
Error::from_kind(ErrorKind::Gitlab(msg.into()))
}
}
......@@ -218,7 +218,7 @@ impl Gitlab {
let mut users = self.get_paged_with_param("users", &[("username", name.as_ref())])?;
users
.pop()
.ok_or_else(|| Error::from_kind(ErrorKind::Gitlab("no such user".to_string())))
.ok_or_else(|| Error::from_kind(ErrorKind::Gitlab("no such user".into())))
}
/// Get all accessible projects.
......
......@@ -387,7 +387,8 @@ impl<'de> Deserialize<'de> for SystemHook {
let val = <Value as Deserialize>::deserialize(deserializer)?;
let event_name = match val.pointer("/event_name") {
Some(&Value::String(ref name)) => name.to_string(),
// XXX(1.36.0): NLL makes this clone unnecessary.
Some(&Value::String(ref name)) => name.clone(),
Some(_) => {
return Err(D::Error::invalid_type(
Unexpected::Other("JSON value"),
......@@ -399,7 +400,7 @@ impl<'de> Deserialize<'de> for SystemHook {
},
};
let hook_res = match event_name.as_str() {
let hook_res = match event_name.as_ref() {
"project_create" | "project_destroy" | "project_rename" | "project_transfer" => {
serde_json::from_value(val).map(SystemHook::Project)
},
......
This diff is collapsed.
......@@ -1493,7 +1493,7 @@ impl Issue {
has_tasks: None,
confidential: false,
discussion_locked: None,
web_url: "".to_string(),
web_url: "".into(),
_links: None,
}
}
......@@ -2388,7 +2388,7 @@ impl Event {
EventTargetType::Commit => {
self.target_id
.as_str()
.map(|id| EventTargetId::Commit(ObjectId(id.to_string())))
.map(|id| EventTargetId::Commit(ObjectId(id.into())))
},
EventTargetType::Issue => {
self.target_id
......
......@@ -760,7 +760,8 @@ impl<'de> Deserialize<'de> for WebHook {
let val = <Value as Deserialize>::deserialize(deserializer)?;
let object_kind = match val.pointer("/object_kind") {
Some(&Value::String(ref kind)) => kind.to_string(),
// XXX(1.36.0): NLL makes this clone unnecessary.
Some(&Value::String(ref kind)) => kind.clone(),
Some(_) => {
return Err(D::Error::invalid_type(
Unexpected::Other("JSON value"),
......@@ -772,7 +773,7 @@ impl<'de> Deserialize<'de> for WebHook {
},
};
let hook_res = match object_kind.as_str() {
let hook_res = match object_kind.as_ref() {
"push" | "tag_push" => serde_json::from_value(val).map(WebHook::Push),
"issue" => serde_json::from_value(val).map(WebHook::Issue),
......
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