Auto merge of #18773 - emilio:mc-cleanup, r=nox

style: Cleanup MatchingContext construction.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18773)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-07 08:31:44 -05:00 committed by GitHub
commit 438b9df00c

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(),
}
}