style: Cleanup MatchingContext construction.

This commit is contained in:
Emilio Cobos Álvarez 2017-10-07 13:02:32 +02:00
parent 8dece5e74e
commit 36223fc16d
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -94,38 +94,36 @@ pub struct MatchingContext<'a> {
impl<'a> MatchingContext<'a> {
/// Constructs a new `MatchingContext`.
pub fn new(matching_mode: MatchingMode,
pub fn new(
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
quirks_mode: QuirksMode)
-> Self
{
Self {
matching_mode: matching_mode,
bloom_filter: bloom_filter,
nth_index_cache: nth_index_cache,
visited_handling: VisitedHandlingMode::AllLinksUnvisited,
relevant_link_found: false,
quirks_mode: quirks_mode,
classes_and_ids_case_sensitivity: quirks_mode.classes_and_ids_case_sensitivity(),
}
quirks_mode: QuirksMode,
) -> Self {
Self::new_for_visited(
matching_mode,
bloom_filter,
nth_index_cache,
VisitedHandlingMode::AllLinksUnvisited,
quirks_mode
)
}
/// Constructs a new `MatchingContext` for use in visited matching.
pub fn new_for_visited(matching_mode: MatchingMode,
pub fn new_for_visited(
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
visited_handling: VisitedHandlingMode,
quirks_mode: QuirksMode)
-> Self
{
quirks_mode: QuirksMode,
) -> Self {
Self {
matching_mode: matching_mode,
bloom_filter: bloom_filter,
visited_handling: visited_handling,
matching_mode,
bloom_filter,
visited_handling,
nth_index_cache,
quirks_mode,
relevant_link_found: false,
nth_index_cache: nth_index_cache,
quirks_mode: quirks_mode,
classes_and_ids_case_sensitivity: quirks_mode.classes_and_ids_case_sensitivity(),
}
}