|
16 | 16 | You should have received a copy of the GNU General Public License |
17 | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 | */ |
19 | | -use std::collections::HashSet; |
20 | 19 | use std::fs::{File, OpenOptions}; |
21 | 20 | use std::io::{BufReader, BufWriter}; |
22 | 21 | use std::path::{Path, PathBuf}; |
@@ -51,7 +50,7 @@ impl OutputWriter { |
51 | 50 | config::Output::Clang { format, filter, .. } => OutputWriter { |
52 | 51 | output: PathBuf::from(&args.file_name), |
53 | 52 | append: args.append, |
54 | | - filter: validate_filter(filter), |
| 53 | + filter: filter.validate(), |
55 | 54 | format: format.clone(), |
56 | 55 | }, |
57 | 56 | config::Output::Semantic { .. } => { |
@@ -143,31 +142,6 @@ impl OutputWriter { |
143 | 142 | } |
144 | 143 | } |
145 | 144 |
|
146 | | -/// Validate the configuration of the output writer. |
147 | | -/// |
148 | | -/// Validation is always successful, but it may modify the configuration values. |
149 | | -fn validate_filter(filter: &config::Filter) -> config::Filter { |
150 | | - config::Filter { |
151 | | - source: filter.source.clone(), |
152 | | - compilers: filter.compilers.clone(), |
153 | | - duplicates: config::DuplicateFilter { |
154 | | - by_fields: validate_duplicates_by_fields(filter.duplicates.by_fields.as_slice()), |
155 | | - }, |
156 | | - } |
157 | | -} |
158 | | - |
159 | | -/// Validate the fields of the configuration. |
160 | | -/// |
161 | | -/// Removes the duplicates from the list of fields. |
162 | | -fn validate_duplicates_by_fields(fields: &[config::OutputFields]) -> Vec<config::OutputFields> { |
163 | | - fields |
164 | | - .into_iter() |
165 | | - .map(|field| field.clone()) |
166 | | - .collect::<HashSet<_>>() |
167 | | - .into_iter() |
168 | | - .collect() |
169 | | -} |
170 | | - |
171 | 145 | pub fn into_entries(value: semantic::Meaning) -> Result<Vec<Entry>, anyhow::Error> { |
172 | 146 | match value { |
173 | 147 | semantic::Meaning::Compiler { |
|
0 commit comments