Reduce warnings

This commit is contained in:
Jeremy Soller
2018-11-10 07:52:45 -07:00
parent 131dcac554
commit ebffc977b2
20 changed files with 28 additions and 54 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
use super::{constants, Buffer, BUFSIZ, FILE, UNGET};
use super::{constants, Buffer, BUFSIZ, FILE};
use core::cell::UnsafeCell;
use core::ptr;
use core::sync::atomic::AtomicBool;
use fs::File;
use io::LineWriter;
-2
View File
@@ -1,6 +1,4 @@
use alloc::boxed::Box;
use core::sync::atomic::AtomicBool;
use core::{mem, ptr};
use fs::File;
use header::errno;
+3 -4
View File
@@ -3,10 +3,9 @@
use alloc::borrow::{Borrow, BorrowMut};
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::fmt;
use core::fmt::Write as WriteFmt;
use core::fmt::{self, Error};
use core::ops::{Deref, DerefMut};
use core::sync::atomic::{self, AtomicBool, Ordering};
use core::{ptr, str, slice};
use va_list::VaList as va_list;
@@ -16,7 +15,7 @@ use header::errno::{self, STR_ERROR};
use header::fcntl;
use header::stdlib::mkstemp;
use header::string::strlen;
use io::{self, BufRead, LineWriter, SeekFrom, Read, Write};
use io::{self, BufRead, LineWriter, Read, Write};
use mutex::Mutex;
use platform::types::*;
use platform::{Pal, Sys};
@@ -513,7 +512,7 @@ pub extern "C" fn ftell(stream: *mut FILE) -> c_long {
/// Get the current position of the cursor in the file
#[no_mangle]
pub extern "C" fn ftello(stream: *mut FILE) -> off_t {
let mut stream = unsafe { &mut *stream }.lock();
let stream = unsafe { &mut *stream }.lock();
let pos = Sys::lseek(*stream.file, 0, SEEK_CUR);
if pos < 0 {
return -1;
+5 -7
View File
@@ -1,14 +1,12 @@
use alloc::string::String;
use alloc::string::ToString;
use alloc::vec::Vec;
use core::fmt::Write as CoreWrite;
use core::ops::Range;
use core::{fmt, ptr, slice, str};
use core::{fmt, slice};
use c_str::CStr;
use io::{self, Write};
use platform;
use platform::types::*;
use platform::{self, WriteByte};
use va_list::{VaList, VaPrimitive};
#[derive(PartialEq, Eq)]
@@ -221,7 +219,7 @@ fn fmt_float_exp<W: Write>(
}
let string = float_string(float, precision, trim);
let mut len = string.len() + 2 + 2.max(exp_len);
let len = string.len() + 2 + 2.max(exp_len);
pad(w, !left, b' ', len..pad_space)?;
let bytes = if string.starts_with('-') {
@@ -261,8 +259,8 @@ fn fmt_float_normal<W: Write>(
Ok(string.len())
}
unsafe fn inner_printf<W: Write>(w: W, format: *const c_char, mut ap: VaList) -> io::Result<c_int> {
let mut w = &mut platform::CountingWriter::new(w);
unsafe fn inner_printf<W: Write>(w: W, format: *const c_char, ap: VaList) -> io::Result<c_int> {
let w = &mut platform::CountingWriter::new(w);
let mut ap = BufferedVaList::new(ap);
let mut format = format as *const u8;