Fix some warnings
This commit is contained in:
		
							parent
							
								
									ce2278ce45
								
							
						
					
					
						commit
						292688a840
					
				| @ -392,7 +392,7 @@ impl Parse for Block { | ||||
|                 // if semicolon is missing.
 | ||||
|                 if !matches!(e, Expression(ExpressionKind::IfExpr(_), _)) { | ||||
|                     // In theory could ignore the missing semicolon..
 | ||||
|                     return Err(stream.expected_err("expected semicolon to complete statement")?); | ||||
|                     return Err(stream.expected_err("semicolon to complete statement")?); | ||||
|                 } | ||||
| 
 | ||||
|                 statements.push(BlockLevelStatement::Expression(e)); | ||||
|  | ||||
| @ -4,18 +4,11 @@ use std::{ | ||||
| }; | ||||
| 
 | ||||
| use crate::{ | ||||
|     ast, | ||||
|     lexer::{self, Cursor, FullToken, Position}, | ||||
|     mir::{self, pass, Metadata, SourceModuleId}, | ||||
|     token_stream::{self, TokenRange}, | ||||
| }; | ||||
| 
 | ||||
| impl<T: std::error::Error + std::fmt::Display> pass::Error<T> { | ||||
|     fn fmt_simple(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||
|         std::fmt::Display::fmt(&self.kind, f) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| fn label(text: &str) -> &str { | ||||
|     #[cfg(debug_assertions)] | ||||
|     { | ||||
|  | ||||
| @ -1,7 +1,4 @@ | ||||
| use std::{ | ||||
|     fmt::{Debug, Write}, | ||||
|     str::Chars, | ||||
| }; | ||||
| use std::{fmt::Debug, str::Chars}; | ||||
| 
 | ||||
| static DECIMAL_NUMERICS: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; | ||||
| 
 | ||||
|  | ||||
| @ -41,13 +41,12 @@ | ||||
| //! - Debug Symbols
 | ||||
| //! ```
 | ||||
| 
 | ||||
| use std::{convert::Infallible, path::PathBuf}; | ||||
| use std::path::PathBuf; | ||||
| 
 | ||||
| use error_raporting::{ErrorKind as ErrorRapKind, ModuleMap, ReidError}; | ||||
| use lexer::FullToken; | ||||
| use mir::{ | ||||
|     linker::LinkerPass, typecheck::TypeCheck, typeinference::TypeInference, typerefs::TypeRefs, | ||||
|     SourceModuleId, | ||||
| }; | ||||
| use reid_lib::{compile::CompileOutput, Context}; | ||||
| 
 | ||||
|  | ||||
| @ -1,8 +1,4 @@ | ||||
| use super::{ | ||||
|     typecheck::ErrorKind, | ||||
|     typerefs::{ScopeTypeRefs, TypeRef, TypeRefs}, | ||||
|     VagueType as Vague, *, | ||||
| }; | ||||
| use super::{typecheck::ErrorKind, typerefs::TypeRefs, VagueType as Vague, *}; | ||||
| 
 | ||||
| #[derive(Debug, Clone)] | ||||
| pub enum ReturnTypeOther { | ||||
|  | ||||
| @ -12,7 +12,7 @@ use crate::{compile_module, error_raporting::ModuleMap, lexer::FullToken, parse_ | ||||
| use super::{ | ||||
|     pass::{Pass, PassState}, | ||||
|     r#impl::EqualsIssue, | ||||
|     Context, FunctionDefinition, Import, Metadata, Module, SourceModuleId, | ||||
|     Context, FunctionDefinition, Import, Metadata, Module, | ||||
| }; | ||||
| 
 | ||||
| pub static STD_SOURCE: &str = include_str!("../../lib/std.reid"); | ||||
|  | ||||
| @ -4,10 +4,7 @@ | ||||
| 
 | ||||
| use std::{collections::HashMap, path::PathBuf}; | ||||
| 
 | ||||
| use crate::{ | ||||
|     lexer::{FullToken, Position}, | ||||
|     token_stream::TokenRange, | ||||
| }; | ||||
| use crate::{lexer::Position, token_stream::TokenRange}; | ||||
| 
 | ||||
| mod display; | ||||
| pub mod r#impl; | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
| 
 | ||||
| use crate::{ | ||||
|     ast::parse::Parse, | ||||
|     lexer::{FullToken, Position, Token}, | ||||
|     lexer::{FullToken, Token}, | ||||
| }; | ||||
| 
 | ||||
| /// Utility struct that is able to parse [`FullToken`]s while being
 | ||||
| @ -175,15 +175,6 @@ impl<'a, 'b> TokenStream<'a, 'b> { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fn get_position(&self, offset: usize) -> Result<Position, Error> { | ||||
|         if self.tokens.is_empty() { | ||||
|             Err(Error::FileEmpty) | ||||
|         } else { | ||||
|             let token_idx = (self.position - 1).min(self.tokens.len() - 1); | ||||
|             Ok(self.tokens[token_idx].position) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_range(&self) -> Option<TokenRange> { | ||||
|         self.ref_position.as_ref().map(|ref_pos| TokenRange { | ||||
|             start: **ref_pos, | ||||
| @ -237,7 +228,7 @@ impl std::iter::Sum for TokenRange { | ||||
| 
 | ||||
| #[derive(thiserror::Error, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] | ||||
| pub enum Error { | ||||
|     #[error("Expected {} got {:?}", .0, .1)] | ||||
|     #[error("Expected {} got \"{}\"", .0, .1.to_string())] | ||||
|     Expected(String, Token, TokenRange), | ||||
|     #[error("Source file contains no tokens")] | ||||
|     FileEmpty, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user