[][src]Struct rune::Warnings

pub struct Warnings { /* fields omitted */ }

Compilation warnings.

Implementations

impl Warnings[src]

pub fn disabled() -> Self[src]

Construct a new, empty collection of compilation warnings that is disabled, i.e. any warnings added to it will be ignored.

Examples

use rune::Warnings;
use runestick::Span;

let mut warnings = Warnings::disabled();
assert!(warnings.is_empty());
warnings.not_used(0, Span::empty(), None);

pub fn new() -> Self[src]

Construct a new, empty collection of compilation warnings.

Examples

use rune::{Warnings, Warning, WarningKind};
use runestick::Span;

let mut warnings = Warnings::new();
assert!(warnings.is_empty());
warnings.not_used(0, Span::empty(), None);
assert!(!warnings.is_empty());

assert!(matches!(warnings.iter().next(), Some(Warning { source_id: 0, kind: WarningKind::NotUsed { .. } })));

pub fn is_empty(&self) -> bool[src]

Indicate if there are warnings or not.

pub fn iter(&self) -> impl Iterator<Item = &Warning>[src]

Get an iterator over all the warnings.

pub fn not_used(&mut self, source_id: usize, span: Span, context: Option<Span>)[src]

Indicate that a value is produced but never used.

pub fn let_pattern_might_panic(
    &mut self,
    source_id: usize,
    span: Span,
    context: Option<Span>
)
[src]

Indicate that a binding pattern might panic.

Like let (a, b) = value.

pub fn template_without_expansions(
    &mut self,
    source_id: usize,
    span: Span,
    context: Option<Span>
)
[src]

Indicate that we encountered a template string without any expansion groups.

Like `Hello`.

pub fn remove_tuple_call_parens(
    &mut self,
    source_id: usize,
    span: Span,
    variant: Span,
    context: Option<Span>
)
[src]

Add a warning indicating that the parameters of an empty tuple can be removed when creating it.

Like None().

pub fn uneccessary_semi_colon(&mut self, source_id: usize, span: Span)[src]

Add a warning about an unecessary semi-colon.

Trait Implementations

impl Clone for Warnings[src]

impl Debug for Warnings[src]

impl Default for Warnings[src]

impl<'a> IntoIterator for &'a Warnings[src]

type IntoIter = Iter<'a, Warning>

Which kind of iterator are we turning this into?

type Item = &'a Warning

The type of the elements being iterated over.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,