Remove warnings.

This commit is contained in:
Stephen Chung 2022-01-27 16:57:00 +08:00
parent dd937e657d
commit 64de20bcd3

View File

@ -1,8 +1,10 @@
#[cfg(feature = "debugging")]
use rhai::{Dynamic, Engine, EvalAltResult, Position, Scope}; use rhai::{Dynamic, Engine, EvalAltResult, Position, Scope};
#[cfg(feature = "debugging")] #[cfg(feature = "debugging")]
use rhai::debugger::DebuggerCommand; use rhai::debugger::DebuggerCommand;
#[cfg(feature = "debugging")]
use std::{ use std::{
cell::RefCell, cell::RefCell,
env, env,
@ -13,6 +15,7 @@ use std::{
}; };
/// Pretty-print source line. /// Pretty-print source line.
#[cfg(feature = "debugging")]
fn print_source(lines: &[String], pos: Position, offset: usize) { fn print_source(lines: &[String], pos: Position, offset: usize) {
let line_no = if lines.len() > 1 { let line_no = if lines.len() > 1 {
if pos.is_none() { if pos.is_none() {
@ -40,6 +43,7 @@ fn print_source(lines: &[String], pos: Position, offset: usize) {
} }
/// Pretty-print error. /// Pretty-print error.
#[cfg(feature = "debugging")]
fn print_error(input: &str, mut err: EvalAltResult) { fn print_error(input: &str, mut err: EvalAltResult) {
let lines: Vec<_> = input.trim().split('\n').collect(); let lines: Vec<_> = input.trim().split('\n').collect();
let pos = err.take_position(); let pos = err.take_position();
@ -73,6 +77,7 @@ fn print_error(input: &str, mut err: EvalAltResult) {
} }
/// Print debug help. /// Print debug help.
#[cfg(feature = "debugging")]
fn print_debug_help() { fn print_debug_help() {
println!("help => print this help"); println!("help => print this help");
println!("quit, exit, kill => quit"); println!("quit, exit, kill => quit");
@ -107,6 +112,7 @@ fn print_debug_help() {
} }
/// Display the scope. /// Display the scope.
#[cfg(feature = "debugging")]
fn print_scope(scope: &Scope, dedup: bool) { fn print_scope(scope: &Scope, dedup: bool) {
let flattened_clone; let flattened_clone;
let scope = if dedup { let scope = if dedup {