From 34233725b026212f8e8dd880e00b17cf22324d84 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 19 Apr 2016 21:49:50 -0400 Subject: Rename is_alias_in_file to find_alias_in_file I think we should return a list of matched aliases from this function instead of a simple boolean value. As such, we'll start by renaming the function to something that makes sense in that context. We now need to modify the function and return type in order to provide that information. --- src/main.rs | 2 +- src/tests.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 79e3411..a4a36e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,7 @@ fn build_alias(s: &str) -> String { alias_line } -fn is_alias_in_file(alias: &Alias, file: &str) -> Result<(), io::Error> { +fn find_alias_in_file(alias: &Alias, file: &str) -> Result<(), io::Error> { let f = try!(File::open(file)); let file = BufReader::new(&f); for line in file.lines() { diff --git a/src/tests.rs b/src/tests.rs index 29723cd..ccacd29 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,4 +1,4 @@ -use super::{Alias, is_alias_in_file}; +use super::{Alias, find_alias_in_file}; #[test] fn new_alias_with_only_email() { @@ -42,8 +42,8 @@ fn new_alias_with_special_characters() { #[test] -fn is_alias_in_file_finds_a_match() { - is_alias_in_file( +fn find_alias_in_file_finds_a_match() { + find_alias_in_file( &Alias { alias: "farnsworth-hubert".to_owned(), name: "Hubert Farnsworth".to_owned(), -- cgit v1.2.3