Skip to content

Commit 834b3a5

Browse files
committed
suppress warnings, allow ASpaceTranscriber to be transcribing over non-static slices
1 parent 5b3142a commit 834b3a5

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

expr/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::unused_io_amount)]
12
#[allow(unused_imports)]
23
use std::{
34
fmt::{format, Debug, Formatter, Write},

frontend/src/json_parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::unused_io_amount)]
12
use std::{str, slice};
23
use std::char::decode_utf16;
34
use std::convert::TryFrom;

kernel/src/space.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl <'a, 'c> ASpaceTranscriber<'a, 'c> {
315315
(self.count, self.wz, self.pdp)
316316
}
317317
}
318-
impl <'a, 'c> mork_frontend::json_parser::ATranscriber<&'static [u8]> for ASpaceTranscriber<'a, 'c> {
318+
impl <'a, 'c> mork_frontend::json_parser::ATranscriber<&'bytes [u8]> for ASpaceTranscriber<'a, 'c> {
319319
#[inline] fn descend_index(&mut self, i: usize, first: bool) -> () {
320320
if first { self.wz.push(item_byte(Tag::Arity(2))); }
321321
let token = self.pdp.tokenizer(i.to_string().as_bytes());
@@ -326,7 +326,7 @@ impl <'a, 'c> mork_frontend::json_parser::ATranscriber<&'static [u8]> for ASpace
326326
self.wz.truncate(self.wz.len() - (self.pdp.tokenizer(i.to_string().as_bytes()).len() + 1));
327327
if last { self.wz.truncate(self.wz.len() - 1); }
328328
}
329-
#[inline] fn write_empty_array(&mut self) -> impl Iterator<Item=&'static [u8]> { self.count += 1; self.write("[]") }
329+
#[inline] fn write_empty_array(&mut self) -> impl Iterator<Item=&'bytes [u8]> { self.count += 1; self.write("[]") }
330330
#[inline] fn descend_key(&mut self, k: &str, first: bool) -> () {
331331
if first { self.wz.push(item_byte(Tag::Arity(2))); }
332332
let token = self.pdp.tokenizer(k.as_bytes());
@@ -338,21 +338,21 @@ impl <'a, 'c> mork_frontend::json_parser::ATranscriber<&'static [u8]> for ASpace
338338
self.wz.truncate(self.wz.len() - (token.len() + 1));
339339
if last { self.wz.truncate(self.wz.len() - 1); }
340340
}
341-
#[inline] fn write_empty_object(&mut self) -> impl Iterator<Item=&'static [u8]> { self.count += 1; self.write("{}") }
342-
#[inline] fn write_string(&mut self, s: &str) -> impl Iterator<Item=&'static [u8]> { self.count += 1; self.write(s) }
343-
#[inline] fn write_number(&mut self, negative: bool, mantissa: u64, exponent: i16) -> impl Iterator<Item=&'static [u8]> {
341+
#[inline] fn write_empty_object(&mut self) -> impl Iterator<Item=&'bytes [u8]> { self.count += 1; self.write("{}") }
342+
#[inline] fn write_string(&mut self, s: &str) -> impl Iterator<Item=&'bytes [u8]> { self.count += 1; self.write(s) }
343+
#[inline] fn write_number(&mut self, negative: bool, mantissa: u64, exponent: i16) -> impl Iterator<Item=&'bytes [u8]> {
344344
let mut buf = [0u8; 64];
345345
let mut cur = std::io::Cursor::new(&mut buf[..]);
346346
if negative { write!(cur, "-").unwrap(); }
347347
write!(cur, "{}", mantissa).unwrap();
348348
if exponent != 0 { write!(cur, "e{}", exponent).unwrap(); }
349349
let len = cur.position() as usize;
350350
self.count += 1;
351-
self.write(unsafe { std::mem::transmute::<_, &'static [u8]>(&cur.into_inner()[..len]) })
351+
self.write(unsafe { std::mem::transmute::<_, &'bytes [u8]>(&cur.into_inner()[..len]) })
352352
}
353-
#[inline] fn write_true(&mut self) -> impl Iterator<Item=&'static [u8]> { self.count += 1; self.write("true") }
354-
#[inline] fn write_false(&mut self) -> impl Iterator<Item=&'static [u8]> { self.count += 1; self.write("false") }
355-
#[inline] fn write_null(&mut self) -> impl Iterator<Item=&'static [u8]> { self.count += 1; self.write("null") }
353+
#[inline] fn write_true(&mut self) -> impl Iterator<Item=&'bytes [u8]> { self.count += 1; self.write("true") }
354+
#[inline] fn write_false(&mut self) -> impl Iterator<Item=&'bytes [u8]> { self.count += 1; self.write("false") }
355+
#[inline] fn write_null(&mut self) -> impl Iterator<Item=&'bytes [u8]> { self.count += 1; self.write("null") }
356356
#[inline] fn begin(&mut self) -> () {}
357357
#[inline] fn end(&mut self) -> () {}
358358
}

0 commit comments

Comments
 (0)