minitrace-rust icon indicating copy to clipboard operation
minitrace-rust copied to clipboard

#[cfg(test)] args are not IDE friendly

Open breezewish opened this issue 3 years ago • 4 comments

With latest intellij-rust (14 Feb 2022), the IDE doesn't work well for such functions:

image

breezewish avatar Mar 03 '22 08:03 breezewish

How about making it a new function like:

#[cfg(test)]
pub fn root_with_collect(event: &'static str, collect: GlobalCollect) -> (Self, Collector) {}

Xuanwo avatar Mar 05 '22 04:03 Xuanwo

I suspect that the plugin mistakenly set cfg(test) to true for doctest.

andylokandy avatar Mar 08 '22 16:03 andylokandy

I also see this behavior in the VS-Code IDE.

Not sure what the plans are for the collect: parameter.... if it is intended to allow this to be passed-in, in the future, you could have it as an optional parameter for the intervening period (where tests are the only use case):

pub fn root(event: &'static str, collect: Option<GlobalCollect>)

Then default usage would, until that time arrives, be Span::root("root", None)

taqtiqa-mark avatar Mar 15 '22 09:03 taqtiqa-mark

Collating functions similarly affected:

taqtiqa-mark avatar Mar 15 '22 10:03 taqtiqa-mark