pub enum WarningKind {
UnusedVariable(String),
UnusedFunction(String),
UnreachableCode,
UnreachablePattern(String),
ComptimeDbgPresent(String),
}Expand description
The kind of compilation warning.
Variants§
UnusedVariable(String)
A variable was declared but never used.
UnusedFunction(String)
A function was declared but never called.
UnreachableCode
Code that will never be executed.
UnreachablePattern(String)
A pattern that will never be matched because a previous pattern already covers it.
ComptimeDbgPresent(String)
A comptime-evaluated @dbg call was present during compilation.
Implementations§
Source§impl WarningKind
impl WarningKind
Sourcepub fn unused_variable_name(&self) -> Option<&str>
pub fn unused_variable_name(&self) -> Option<&str>
Returns the variable name if this is an UnusedVariable warning.
Sourcepub fn format_with_line(&self, line_number: Option<usize>) -> String
pub fn format_with_line(&self, line_number: Option<usize>) -> String
Format the warning message with an optional line number.
When line_number is Some, the line number is appended to the message
for warnings that have a name (like unused variables). This helps
disambiguate when multiple variables share the same name.
Trait Implementations§
Source§impl Clone for WarningKind
impl Clone for WarningKind
Source§fn clone(&self) -> WarningKind
fn clone(&self) -> WarningKind
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WarningKind
impl Debug for WarningKind
Source§impl Display for WarningKind
impl Display for WarningKind
Source§impl Error for WarningKind
impl Error for WarningKind
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl PartialEq for WarningKind
impl PartialEq for WarningKind
impl Eq for WarningKind
impl StructuralPartialEq for WarningKind
Auto Trait Implementations§
impl Freeze for WarningKind
impl RefUnwindSafe for WarningKind
impl Send for WarningKind
impl Sync for WarningKind
impl Unpin for WarningKind
impl UnwindSafe for WarningKind
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
Mutably borrows from an owned value. Read more