clippy: &Vec<T> -> &[T]
This commit is contained in:
parent
7eb3b81f56
commit
848f1a0952
11 changed files with 21 additions and 21 deletions
|
@ -48,7 +48,7 @@ impl BuildJob {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from(data: &Vec<u8>) -> Result<BuildJob, serde_json::error::Error> {
|
||||
pub fn from(data: &[u8]) -> Result<BuildJob, serde_json::error::Error> {
|
||||
serde_json::from_slice(&data)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use ofborg::worker;
|
|||
use serde_json;
|
||||
|
||||
|
||||
pub fn from(data: &Vec<u8>) -> Result<MassRebuildJob, serde_json::error::Error> {
|
||||
pub fn from(data: &[u8]) -> Result<MassRebuildJob, serde_json::error::Error> {
|
||||
serde_json::from_slice(&data)
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ pub trait SimpleNotifyWorker {
|
|||
&self,
|
||||
method: &Deliver,
|
||||
headers: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String>;
|
||||
}
|
||||
|
||||
|
|
|
@ -276,13 +276,13 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker {
|
|||
&self,
|
||||
_: &Deliver,
|
||||
_: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String> {
|
||||
println!("lmao I got a job?");
|
||||
match buildjob::from(body) {
|
||||
Ok(e) => Ok(e),
|
||||
Err(e) => {
|
||||
println!("{:?}", String::from_utf8(body.clone()));
|
||||
println!("{:?}", String::from_utf8(body.to_vec()));
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ impl worker::SimpleWorker for EvaluationFilterWorker {
|
|||
&mut self,
|
||||
_: &Deliver,
|
||||
_: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String> {
|
||||
match serde_json::from_slice(body) {
|
||||
Ok(e) => Ok(e),
|
||||
|
@ -37,7 +37,7 @@ impl worker::SimpleWorker for EvaluationFilterWorker {
|
|||
Err(format!(
|
||||
"Failed to deserialize job {:?}: {:?}",
|
||||
e,
|
||||
String::from_utf8(body.clone())
|
||||
String::from_utf8(body.to_vec())
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,14 +35,14 @@ impl worker::SimpleWorker for GitHubCommentWorker {
|
|||
&mut self,
|
||||
_: &Deliver,
|
||||
_: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String> {
|
||||
match serde_json::from_slice(body) {
|
||||
Ok(e) => Ok(e),
|
||||
Err(e) => {
|
||||
println!(
|
||||
"Failed to deserialize IsssueComment: {:?}",
|
||||
String::from_utf8(body.clone())
|
||||
String::from_utf8(body.to_vec())
|
||||
);
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
|
|
|
@ -28,14 +28,14 @@ impl worker::SimpleWorker for GitHubCommentPoster {
|
|||
&mut self,
|
||||
_: &Deliver,
|
||||
_: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String> {
|
||||
match serde_json::from_slice(body) {
|
||||
Ok(e) => Ok(e),
|
||||
Err(e) => {
|
||||
Err(format!(
|
||||
"Failed to deserialize BuildResult: {:?}, err: {:}",
|
||||
String::from_utf8_lossy(&body.clone()),
|
||||
String::from_utf8_lossy(&body.to_vec()),
|
||||
e
|
||||
))
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ fn result_to_comment(result: &LegacyBuildResult) -> String {
|
|||
}
|
||||
|
||||
if result.output.len() > 0 {
|
||||
reply.extend(partial_log_segment(&result.output));
|
||||
reply.extend(partial_log_segment(result.output.clone()));
|
||||
reply.push("".to_owned());
|
||||
reply.push("".to_owned());
|
||||
} else {
|
||||
|
@ -228,7 +228,7 @@ fn list_segment(name: &str, things: &[String]) -> Vec<String> {
|
|||
reply
|
||||
}
|
||||
|
||||
fn partial_log_segment(output: &Vec<String>) -> Vec<String> {
|
||||
fn partial_log_segment(output: Vec<String>) -> Vec<String> {
|
||||
let mut reply: Vec<String> = vec![];
|
||||
|
||||
reply.push(
|
||||
|
|
|
@ -186,7 +186,7 @@ impl worker::SimpleWorker for LogMessageCollector {
|
|||
&mut self,
|
||||
deliver: &Deliver,
|
||||
_: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String> {
|
||||
|
||||
let message: MsgType;
|
||||
|
|
|
@ -99,7 +99,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
|
|||
&mut self,
|
||||
_: &Deliver,
|
||||
_: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String> {
|
||||
self.events.notify(Event::JobReceived);
|
||||
match massrebuildjob::from(body) {
|
||||
|
@ -111,7 +111,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
|
|||
self.events.notify(Event::JobDecodeFailure);
|
||||
error!(
|
||||
"Failed to decode message: {:?}, Err: {:?}",
|
||||
String::from_utf8(body.clone()),
|
||||
String::from_utf8(body.to_vec()),
|
||||
e
|
||||
);
|
||||
Err("Failed to decode message".to_owned())
|
||||
|
@ -618,7 +618,7 @@ fn make_gist<'a>(
|
|||
)
|
||||
}
|
||||
|
||||
pub fn update_labels(issue: &hubcaps::issues::IssueRef, add: &Vec<String>, remove: &Vec<String>) {
|
||||
pub fn update_labels(issue: &hubcaps::issues::IssueRef, add: &[String], remove: &[String]) {
|
||||
let l = issue.labels();
|
||||
|
||||
let existing: Vec<String> = issue
|
||||
|
|
|
@ -27,13 +27,13 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for StatCollectorWorker
|
|||
&mut self,
|
||||
_: &Deliver,
|
||||
_: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String> {
|
||||
match serde_json::from_slice(body) {
|
||||
Ok(e) => Ok(e),
|
||||
Err(_) => {
|
||||
let mut modified_body: Vec<u8> = vec!["\"".as_bytes()[0]];
|
||||
modified_body.append(&mut body.clone());
|
||||
modified_body.append(&mut body.to_vec());
|
||||
modified_body.push("\"".as_bytes()[0]);
|
||||
|
||||
match serde_json::from_slice(&modified_body) {
|
||||
|
@ -48,7 +48,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for StatCollectorWorker
|
|||
self.events.notify(stats::Event::StatCollectorBogusEvent);
|
||||
error!(
|
||||
"Failed to decode message: {:?}, Err: {:?}",
|
||||
String::from_utf8(body.clone()),
|
||||
String::from_utf8(body.to_vec()),
|
||||
e
|
||||
);
|
||||
Err("Failed to decode message".to_owned())
|
||||
|
|
|
@ -63,7 +63,7 @@ pub trait SimpleWorker: Send + 'static {
|
|||
&mut self,
|
||||
method: &Deliver,
|
||||
headers: &BasicProperties,
|
||||
body: &Vec<u8>,
|
||||
body: &[u8],
|
||||
) -> Result<Self::J, String>;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue