cargo fix + fmt

This commit is contained in:
Timothy Andrew 2020-06-03 00:54:02 +05:30
parent 32f11494c2
commit 8724149a04
No known key found for this signature in database
GPG Key ID: ABD64509E977B249
4 changed files with 17 additions and 8 deletions

View File

@ -35,8 +35,12 @@ impl PullRequest {
&self.base.label
}
pub fn number(&self) -> usize { self.number }
pub fn title(&self) -> &str { &self.title }
pub fn number(&self) -> usize {
self.number
}
pub fn title(&self) -> &str {
&self.title
}
}
#[derive(Deserialize, Debug)]

View File

@ -1,6 +1,6 @@
use petgraph::Graph;
use std::collections::HashMap;
use std::rc::Rc;
use petgraph::Graph;
use crate::api::search::PullRequest;

View File

@ -1,8 +1,8 @@
use std::collections::HashMap;
use std::rc::Rc;
use std::env;
use std::error::Error;
use std::process;
use std::rc::Rc;
use gh_stack::api;
use gh_stack::graph;

View File

@ -1,8 +1,8 @@
use petgraph::{Direction,Graph};
use std::rc::Rc;
use petgraph::visit::Bfs;
use petgraph::visit::EdgeRef;
use petgraph::{Direction, Graph};
use regex::Regex;
use std::rc::Rc;
use crate::api::search::PullRequest;
@ -25,9 +25,14 @@ pub fn build_table(graph: Graph<Rc<PullRequest>, usize>) -> String {
while let Some(node) = bfs.next(&graph) {
let parent = graph.edges_directed(node, Direction::Incoming).next();
let node: Rc<PullRequest> = graph[node].clone();
let row = match parent {
Some(parent) => format!("|#{}|{}|#{}|\n", node.number(), node.title(), graph[parent.source().clone()].number()),
Some(parent) => format!(
"|#{}|{}|#{}|\n",
node.number(),
node.title(),
graph[parent.source().clone()].number()
),
None => format!("|#{}|{}|**N/A**|\n", node.number(), node.title()),
};