pub struct ConstantParameter {Show 16 fields
pub path: PathBuf,
pub function_name: String,
pub parameter_name: String,
pub parameter_index: u32,
pub option_key: Option<String>,
pub line: u32,
pub col: u32,
pub reason: ConstantParameterReason,
pub evidence: Option<ConstantParameterEvidence>,
pub value: Option<ConstantParameterValue>,
pub optional: bool,
pub has_default: bool,
pub condition_reads: u32,
pub call_site_count: u32,
pub inspected_call_sites: Vec<ConstantParameterCallSite>,
pub explanation: String,
}Expand description
A parameter that each visible call of its function passes in one way.
Fields§
§path: PathBufSource path of the function.
function_name: StringThe module-scope binding name of the function. For a method of an
exported class, which only type-aware mode reports, Class.method.
parameter_name: StringThe parameter name. For an option key, the local binding of the key
in the object pattern: abort for { signal: abort }.
parameter_index: u320-based index of the parameter. A TypeScript this parameter does
not count.
option_key: Option<String>The property key, when the finding is about one key of an
object-pattern parameter: retries in { retries = 3 }. Absent for
a plain parameter.
line: u321-based line of the parameter, or of the key binding.
col: u320-based byte column of the parameter, or of the key binding.
reason: ConstantParameterReasonWhy the rule reports the parameter.
evidence: Option<ConstantParameterEvidence>The evidence that the finding needs beyond the syntactic call facts. Absent for a finding that the call facts prove alone.
value: Option<ConstantParameterValue>The value that each call passes. Present if and only if reason is
identical-argument.
optional: booltrue when the parameter has the TypeScript ? marker.
has_default: booltrue when the parameter, or the option key, has a default value.
condition_reads: u32The count of conditional tests in the function whose test is the
parameter, !parameter or !!parameter: the test of an if, a
?:, a while, a do or a for. Nested functions count. A
comparison such as parameter === true and an operand of && or
|| do not count.
call_site_count: u32The count of calls that the rule read for this parameter. A recursive call that passes the parameter on unchanged does not count.
inspected_call_sites: Vec<ConstantParameterCallSite>The first calls in source order, at most 20. The list is never longer
than call_site_count.
explanation: StringWhat the finding means and what static analysis does not prove.
Implementations§
Trait Implementations§
Source§impl Clone for ConstantParameter
impl Clone for ConstantParameter
Source§fn clone(&self) -> ConstantParameter
fn clone(&self) -> ConstantParameter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConstantParameter
impl Debug for ConstantParameter
Source§impl<'de> Deserialize<'de> for ConstantParameter
impl<'de> Deserialize<'de> for ConstantParameter
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConstantParameter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConstantParameter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ConstantParameter
impl JsonSchema for ConstantParameter
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Serialize for ConstantParameter
impl Serialize for ConstantParameter
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Forget for ConstantParameter
impl Freeze for ConstantParameter
impl Move for ConstantParameter
impl RefUnwindSafe for ConstantParameter
impl Send for ConstantParameter
impl Sync for ConstantParameter
impl Unpin for ConstantParameter
impl UnsafeUnpin for ConstantParameter
impl UnwindSafe for ConstantParameter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more