1+ use crate :: config;
12use crate :: config:: Compression ;
2- use crate :: { config, path} ;
3- use codeql_extractor:: { extractor, trap} ;
3+ use codeql_extractor:: { extractor, file_paths, trap} ;
44use log:: debug;
55use ra_ap_ide_db:: line_index:: LineCol ;
6- use std:: ffi:: OsString ;
76use std:: fmt:: Debug ;
87use std:: hash:: Hash ;
98use std:: marker:: PhantomData ;
@@ -12,7 +11,6 @@ use std::path::{Path, PathBuf};
1211pub use trap:: Label as UntypedLabel ;
1312pub use trap:: Writer ;
1413
15- //TODO: typed labels
1614pub trait AsTrapKeyPart {
1715 fn as_key_part ( & self ) -> String ;
1816}
@@ -210,19 +208,8 @@ impl TrapFileProvider {
210208 }
211209
212210 pub fn create ( & self , category : & str , key : & Path ) -> TrapFile {
213- let mut path = PathBuf :: from ( category) ;
214- path. push ( path:: key ( key) ) ;
215- path. set_extension (
216- path. extension ( )
217- . map ( |e| {
218- let mut o: OsString = e. to_owned ( ) ;
219- o. push ( ".trap" ) ;
220- o
221- } )
222- . unwrap_or ( "trap" . into ( ) ) ,
223- ) ;
211+ let path = file_paths:: path_for ( & self . trap_dir . join ( category) , key, ".trap" ) ;
224212 debug ! ( "creating trap file {}" , path. display( ) ) ;
225- path = self . trap_dir . join ( path) ;
226213 let mut writer = trap:: Writer :: new ( ) ;
227214 extractor:: populate_empty_location ( & mut writer) ;
228215 TrapFile {
0 commit comments