66//! It can also alter the compiler flags of the compiler calls. The actions
77//! are defined in the configuration this module is given.
88
9- use super :: super :: semantic;
10- use super :: config;
9+ use crate :: semantic;
10+ use crate :: config;
11+ use crate :: semantic:: Transform ;
1112
1213pub enum Transformation {
1314 None ,
@@ -30,34 +31,34 @@ impl From<&config::Output> for Transformation {
3031 }
3132}
3233
33- impl Transformation {
34- pub fn apply ( & self , input : semantic:: CompilerCall ) -> Option < semantic:: CompilerCall > {
34+ impl Transform for Transformation {
35+ fn apply ( & self , input : semantic:: CompilerCall ) -> Option < semantic:: CompilerCall > {
3536 let semantic:: CompilerCall {
3637 compiler,
3738 passes,
3839 working_dir,
3940 } = & input;
4041 match self . lookup ( compiler) {
4142 Some ( config:: Compiler {
42- ignore : config:: Ignore :: Always ,
43- ..
44- } ) => None ,
43+ ignore : config:: Ignore :: Always ,
44+ ..
45+ } ) => None ,
4546 Some ( config:: Compiler {
46- ignore : config:: Ignore :: Conditional ,
47- arguments,
48- ..
49- } ) => {
47+ ignore : config:: Ignore :: Conditional ,
48+ arguments,
49+ ..
50+ } ) => {
5051 if Self :: filter ( arguments, passes) {
5152 None
5253 } else {
5354 Some ( input)
5455 }
5556 }
5657 Some ( config:: Compiler {
57- ignore : config:: Ignore :: Never ,
58- arguments,
59- ..
60- } ) => {
58+ ignore : config:: Ignore :: Never ,
59+ arguments,
60+ ..
61+ } ) => {
6162 let new_passes = Transformation :: execute ( arguments, passes) ;
6263 Some ( semantic:: CompilerCall {
6364 compiler : compiler. clone ( ) ,
@@ -68,7 +69,9 @@ impl Transformation {
6869 None => Some ( input) ,
6970 }
7071 }
72+ }
7173
74+ impl Transformation {
7275 // TODO: allow multiple matches for the same compiler
7376 fn lookup ( & self , compiler : & std:: path:: Path ) -> Option < & config:: Compiler > {
7477 match self {
0 commit comments