@@ -94,7 +94,7 @@ fn print_rebase_error(executable_name: &str, branch: &str, upstream_branch: &str
94
94
}
95
95
96
96
enum BranchSearchResult {
97
- NotPartOfAnyChain ( String ) ,
97
+ NotPartOfAnyChain ,
98
98
Branch ( Branch ) ,
99
99
}
100
100
@@ -139,9 +139,7 @@ impl Branch {
139
139
|| !git_chain. git_local_branch_exists ( branch_name) ?
140
140
{
141
141
Branch :: delete_all_configs ( git_chain, branch_name) ?;
142
- return Ok ( BranchSearchResult :: NotPartOfAnyChain (
143
- branch_name. to_string ( ) ,
144
- ) ) ;
142
+ return Ok ( BranchSearchResult :: NotPartOfAnyChain ) ;
145
143
}
146
144
147
145
let branch = Branch {
@@ -400,7 +398,7 @@ impl Chain {
400
398
let results = Branch :: get_branch_with_chain ( git_chain, branch_name) ?;
401
399
402
400
match results {
403
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
401
+ BranchSearchResult :: NotPartOfAnyChain => {
404
402
// TODO: could this fail silently?
405
403
eprintln ! (
406
404
"Branch not correctly set up as part of a chain: {}" ,
@@ -795,7 +793,7 @@ impl GitChain {
795
793
let results = Branch :: get_branch_with_chain ( self , & branch_name) ?;
796
794
797
795
match results {
798
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
796
+ BranchSearchResult :: NotPartOfAnyChain => {
799
797
self . display_branch_not_part_of_chain_error ( & branch_name) ;
800
798
process:: exit ( 1 ) ;
801
799
}
@@ -817,11 +815,11 @@ impl GitChain {
817
815
let results = Branch :: get_branch_with_chain ( self , branch_name) ?;
818
816
819
817
match results {
820
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
818
+ BranchSearchResult :: NotPartOfAnyChain => {
821
819
Branch :: setup_branch ( self , chain_name, root_branch, branch_name, & sort_option) ?;
822
820
823
821
match Branch :: get_branch_with_chain ( self , branch_name) ? {
824
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
822
+ BranchSearchResult :: NotPartOfAnyChain => {
825
823
eprintln ! ( "Unable to set up chain for branch: {}" , branch_name. bold( ) ) ;
826
824
process:: exit ( 1 ) ;
827
825
}
@@ -849,7 +847,7 @@ impl GitChain {
849
847
let results = Branch :: get_branch_with_chain ( self , & branch_name) ?;
850
848
851
849
match results {
852
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
850
+ BranchSearchResult :: NotPartOfAnyChain => {
853
851
Branch :: delete_all_configs ( self , & branch_name) ?;
854
852
855
853
println ! (
@@ -904,15 +902,15 @@ impl GitChain {
904
902
sort_option : & SortBranch ,
905
903
) -> Result < ( ) , Error > {
906
904
match Branch :: get_branch_with_chain ( self , branch_name) ? {
907
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
905
+ BranchSearchResult :: NotPartOfAnyChain => {
908
906
self . display_branch_not_part_of_chain_error ( branch_name) ;
909
907
process:: exit ( 1 ) ;
910
908
}
911
909
BranchSearchResult :: Branch ( branch) => {
912
910
branch. move_branch ( self , chain_name, sort_option) ?;
913
911
914
912
match Branch :: get_branch_with_chain ( self , & branch. branch_name ) ? {
915
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
913
+ BranchSearchResult :: NotPartOfAnyChain => {
916
914
eprintln ! ( "Unable to move branch: {}" , branch. branch_name. bold( ) ) ;
917
915
process:: exit ( 1 ) ;
918
916
}
@@ -1519,7 +1517,7 @@ fn parse_sort_option(
1519
1517
}
1520
1518
1521
1519
let before_branch = match Branch :: get_branch_with_chain ( git_chain, before_branch) ? {
1522
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1520
+ BranchSearchResult :: NotPartOfAnyChain => {
1523
1521
git_chain. display_branch_not_part_of_chain_error ( before_branch) ;
1524
1522
process:: exit ( 1 ) ;
1525
1523
}
@@ -1545,7 +1543,7 @@ fn parse_sort_option(
1545
1543
}
1546
1544
1547
1545
let after_branch = match Branch :: get_branch_with_chain ( git_chain, after_branch) ? {
1548
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1546
+ BranchSearchResult :: NotPartOfAnyChain => {
1549
1547
git_chain. display_branch_not_part_of_chain_error ( after_branch) ;
1550
1548
process:: exit ( 1 ) ;
1551
1549
}
@@ -1676,7 +1674,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1676
1674
let branch_name = git_chain. get_current_branch_name ( ) ?;
1677
1675
1678
1676
let branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1679
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1677
+ BranchSearchResult :: NotPartOfAnyChain => {
1680
1678
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1681
1679
process:: exit ( 1 ) ;
1682
1680
}
@@ -1756,7 +1754,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1756
1754
let branch_name = git_chain. get_current_branch_name ( ) ?;
1757
1755
1758
1756
let branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1759
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1757
+ BranchSearchResult :: NotPartOfAnyChain => {
1760
1758
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1761
1759
process:: exit ( 1 ) ;
1762
1760
}
@@ -1779,7 +1777,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1779
1777
let branch_name = git_chain. get_current_branch_name ( ) ?;
1780
1778
1781
1779
let branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1782
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1780
+ BranchSearchResult :: NotPartOfAnyChain => {
1783
1781
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1784
1782
process:: exit ( 1 ) ;
1785
1783
}
@@ -1794,7 +1792,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1794
1792
let branch_name = git_chain. get_current_branch_name ( ) ?;
1795
1793
1796
1794
let branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1797
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1795
+ BranchSearchResult :: NotPartOfAnyChain => {
1798
1796
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1799
1797
process:: exit ( 1 ) ;
1800
1798
}
@@ -1810,7 +1808,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1810
1808
let branch_name = git_chain. get_current_branch_name ( ) ?;
1811
1809
1812
1810
let branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1813
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1811
+ BranchSearchResult :: NotPartOfAnyChain => {
1814
1812
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1815
1813
process:: exit ( 1 ) ;
1816
1814
}
@@ -1829,7 +1827,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1829
1827
let branch_name = git_chain. get_current_branch_name ( ) ?;
1830
1828
1831
1829
let branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1832
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1830
+ BranchSearchResult :: NotPartOfAnyChain => {
1833
1831
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1834
1832
process:: exit ( 1 ) ;
1835
1833
}
@@ -1906,7 +1904,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1906
1904
eprintln ! ( "With root branch: {}" , branch. root_branch. bold( ) ) ;
1907
1905
process:: exit ( 1 ) ;
1908
1906
}
1909
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => { }
1907
+ BranchSearchResult :: NotPartOfAnyChain => { }
1910
1908
}
1911
1909
1912
1910
if visited_branches. contains ( branch_name) {
@@ -1943,7 +1941,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1943
1941
let branch_name = git_chain. get_current_branch_name ( ) ?;
1944
1942
1945
1943
let current_branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1946
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1944
+ BranchSearchResult :: NotPartOfAnyChain => {
1947
1945
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1948
1946
process:: exit ( 1 ) ;
1949
1947
}
@@ -1977,7 +1975,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
1977
1975
let branch_name = git_chain. get_current_branch_name ( ) ?;
1978
1976
1979
1977
let current_branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
1980
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
1978
+ BranchSearchResult :: NotPartOfAnyChain => {
1981
1979
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
1982
1980
process:: exit ( 1 ) ;
1983
1981
}
@@ -2011,7 +2009,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
2011
2009
let branch_name = git_chain. get_current_branch_name ( ) ?;
2012
2010
2013
2011
let current_branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
2014
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
2012
+ BranchSearchResult :: NotPartOfAnyChain => {
2015
2013
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
2016
2014
process:: exit ( 1 ) ;
2017
2015
}
@@ -2058,7 +2056,7 @@ fn run(arg_matches: ArgMatches) -> Result<(), Error> {
2058
2056
let branch_name = git_chain. get_current_branch_name ( ) ?;
2059
2057
2060
2058
let current_branch = match Branch :: get_branch_with_chain ( & git_chain, & branch_name) ? {
2061
- BranchSearchResult :: NotPartOfAnyChain ( _ ) => {
2059
+ BranchSearchResult :: NotPartOfAnyChain => {
2062
2060
git_chain. display_branch_not_part_of_chain_error ( & branch_name) ;
2063
2061
process:: exit ( 1 ) ;
2064
2062
}
0 commit comments