Commit b250109 1 parent 8913759 commit b250109 Copy full SHA for b250109
File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ pub struct Metadata<'a> {
72
72
73
73
/// The name of the Rust module where the span occurred, or `None` if this
74
74
/// could not be determined.
75
- module_path : Option < & ' a str > ,
75
+ module_path : Option < Cow < ' a , str > > ,
76
76
77
77
/// The name of the source code file where the span occurred, or `None` if
78
78
/// this could not be determined.
@@ -139,6 +139,13 @@ impl<'a> Metadata<'a> {
139
139
None
140
140
}
141
141
} ;
142
+ let module_path = {
143
+ if let Some ( module_path) = module_path {
144
+ Some ( Cow :: Borrowed ( module_path) )
145
+ } else {
146
+ None
147
+ }
148
+ } ;
142
149
Metadata {
143
150
name : Cow :: Borrowed ( name) ,
144
151
target : Cow :: Borrowed ( target) ,
@@ -177,8 +184,8 @@ impl<'a> Metadata<'a> {
177
184
178
185
/// Returns the path to the Rust module where the span occurred, or
179
186
/// `None` if the module path is unknown.
180
- pub fn module_path ( & self ) -> Option < & ' a str > {
181
- self . module_path
187
+ pub fn module_path ( & ' a self ) -> Option < & ' a str > {
188
+ self . module_path . as_ref ( ) . map ( |p| p . as_ref ( ) )
182
189
}
183
190
184
191
/// Returns the name of the source code file where the span
You can’t perform that action at this time.
0 commit comments