cargo clippy fix
This commit is contained in:
parent
0f5f8a3ec0
commit
b82d968e49
@ -21,7 +21,7 @@ pub struct Body {
|
|||||||
|
|
||||||
impl Body {
|
impl Body {
|
||||||
fn new(id: u32) -> Self {
|
fn new(id: u32) -> Self {
|
||||||
Self { id: id }
|
Self { id }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_id(&self) -> u32 {
|
fn get_id(&self) -> u32 {
|
||||||
@ -38,7 +38,7 @@ pub struct Message {
|
|||||||
impl Message {
|
impl Message {
|
||||||
pub fn new(id: u32, subject: Subject) -> Self {
|
pub fn new(id: u32, subject: Subject) -> Self {
|
||||||
Self {
|
Self {
|
||||||
subject: subject,
|
subject,
|
||||||
body: Some(Body::new(id)),
|
body: Some(Body::new(id)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,9 +62,6 @@ impl Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_body_id(&self) -> Option<u32> {
|
pub fn get_body_id(&self) -> Option<u32> {
|
||||||
match self.body {
|
self.body.as_ref().map(|b| b.get_id())
|
||||||
Some(ref b) => Some(b.get_id()),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,8 +22,8 @@ pub struct Job {
|
|||||||
impl Job {
|
impl Job {
|
||||||
pub fn new(id: i32, action: JobAction) -> Self {
|
pub fn new(id: i32, action: JobAction) -> Self {
|
||||||
Self {
|
Self {
|
||||||
id: id,
|
id,
|
||||||
action: action,
|
action,
|
||||||
status: RunnerStatus::Pending,
|
status: RunnerStatus::Pending,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,13 +34,13 @@ impl Job {
|
|||||||
|
|
||||||
fn deploy(&mut self) -> Result<Message, RunnerError> {
|
fn deploy(&mut self) -> Result<Message, RunnerError> {
|
||||||
self.set_status(RunnerStatus::Running);
|
self.set_status(RunnerStatus::Running);
|
||||||
println!("{} {}", self.format_job(), "deploying...");
|
println!("{} deploying...", self.format_job());
|
||||||
|
|
||||||
let wait = time::Duration::from_secs(5);
|
let wait = time::Duration::from_secs(5);
|
||||||
thread::sleep(wait);
|
thread::sleep(wait);
|
||||||
|
|
||||||
self.set_status(RunnerStatus::Success);
|
self.set_status(RunnerStatus::Success);
|
||||||
println!("{} {}", self.format_job(), "deploy done");
|
println!("{} deploy done", self.format_job());
|
||||||
|
|
||||||
Ok(Message::new(
|
Ok(Message::new(
|
||||||
self.id.try_into().unwrap(),
|
self.id.try_into().unwrap(),
|
||||||
@ -50,13 +50,13 @@ impl Job {
|
|||||||
|
|
||||||
fn check(&mut self) -> Result<Message, RunnerError> {
|
fn check(&mut self) -> Result<Message, RunnerError> {
|
||||||
self.set_status(RunnerStatus::Running);
|
self.set_status(RunnerStatus::Running);
|
||||||
println!("{} {}", self.format_job(), "checking...");
|
println!("{} checking...", self.format_job());
|
||||||
|
|
||||||
let wait = time::Duration::from_millis(50);
|
let wait = time::Duration::from_millis(50);
|
||||||
thread::sleep(wait);
|
thread::sleep(wait);
|
||||||
|
|
||||||
self.set_status(RunnerStatus::Success);
|
self.set_status(RunnerStatus::Success);
|
||||||
println!("{} {}", self.format_job(), "checking done");
|
println!("{} checking done", self.format_job());
|
||||||
|
|
||||||
Ok(Message::empty())
|
Ok(Message::empty())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,12 +50,12 @@ impl<H: Handler, N: Notifier> Worker<H, N> {
|
|||||||
notifier: Arc<N>,
|
notifier: Arc<N>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
id: id,
|
id,
|
||||||
manager: manager,
|
manager,
|
||||||
queue: queue,
|
queue,
|
||||||
status: Arc::new(Mutex::new(WorkerStatus::Pending)),
|
status: Arc::new(Mutex::new(WorkerStatus::Pending)),
|
||||||
shared_handler: shared_handler,
|
shared_handler,
|
||||||
notifier: notifier,
|
notifier,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ impl<H: Handler, N: Notifier> Manager<H, N> {
|
|||||||
status: ManagerStatus::Down,
|
status: ManagerStatus::Down,
|
||||||
queue: Arc::new(Queue::new()),
|
queue: Arc::new(Queue::new()),
|
||||||
shared_handler: Arc::new(shared_handler),
|
shared_handler: Arc::new(shared_handler),
|
||||||
notifier: notifier,
|
notifier,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user