diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-10-07 13:02:32 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-10-07 13:02:32 +0200 |
commit | 36223fc16db36c123affe413e5335cb0e612db38 (patch) | |
tree | 46ab749b98e4d143eb731b9b245dfbe0cda19fd9 /components/selectors/context.rs | |
parent | 8dece5e74e32223d968648080bb371f3be7fbd7c (diff) | |
download | servo-36223fc16db36c123affe413e5335cb0e612db38.tar.gz servo-36223fc16db36c123affe413e5335cb0e612db38.zip |
style: Cleanup MatchingContext construction.
Diffstat (limited to 'components/selectors/context.rs')
-rw-r--r-- | components/selectors/context.rs | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/components/selectors/context.rs b/components/selectors/context.rs index f0da3b14ef6..c67ef6638cc 100644 --- a/components/selectors/context.rs +++ b/components/selectors/context.rs @@ -94,38 +94,36 @@ pub struct MatchingContext<'a> { impl<'a> MatchingContext<'a> { /// Constructs a new `MatchingContext`. - 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(), - } + pub fn new( + matching_mode: MatchingMode, + bloom_filter: Option<&'a BloomFilter>, + nth_index_cache: Option<&'a mut NthIndexCache>, + 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, - bloom_filter: Option<&'a BloomFilter>, - nth_index_cache: Option<&'a mut NthIndexCache>, - visited_handling: VisitedHandlingMode, - quirks_mode: QuirksMode) - -> Self - { + 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 { 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(), } } |