Skip to content

Commit 38301f1

Browse files
Merge pull request #8 from rodrimati1992/0.2_patch
0.2.7 patch
2 parents 305eed8 + 3d48592 commit 38301f1

File tree

27 files changed

+203
-59
lines changed

27 files changed

+203
-59
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ members=[
33
"const_format",
44
"const_format_proc_macros",
55
"print_errors",
6+
"print_warnings",
67
]

const_format/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "const_format"
3-
version = "0.2.6"
3+
version = "0.2.7"
44
authors = ["rodrimati1992 <rodrimatt1985@gmail.com>"]
55
edition = "2018"
66
license = "Zlib"
@@ -34,7 +34,7 @@ only_new_tests = ["testing"]
3434
all = ["fmt", "derive", "constant_time_as_str", "assert"]
3535

3636
[dependencies.const_format_proc_macros]
37-
version = "=0.2.6"
37+
version = "=0.2.7"
3838
path = "../const_format_proc_macros"
3939

4040
[dev-dependencies]

const_format/src/fmt/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// <_< clippy you silly
2+
#![allow(clippy::enum_variant_names)]
3+
14
use core::fmt::{self, Display};
25

36
/// An error while trying to write into a StrWriter.

const_format/src/fmt/formatter.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ impl ComputeStrLength {
7979
self.len
8080
}
8181

82+
/// Whether the length of the computed string is zero.
83+
pub const fn is_empty(&self) -> bool {
84+
self.len == 0
85+
}
86+
8287
/// For borrowing this mutably in macros,just takes and returns a `&mut Self`.
8388
#[inline(always)]
8489
pub const fn borrow_mutably(&mut self) -> &mut Self {

const_format/src/fmt/str_writer_mut.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ macro_rules! write_integer_fn {
755755
cursor-=1;
756756
let digit = (n & 0b1111) as u8;
757757
this_buffer[cursor] = hex_as_ascii(digit);
758-
n = n >> 4;
758+
n >>= 4;
759759
if n == 0 { break }
760760
}
761761

@@ -790,7 +790,7 @@ macro_rules! write_integer_fn {
790790
cursor-=1;
791791
let digit = (n & 1) as u8;
792792
this_buffer[cursor] = hex_as_ascii(digit);
793-
n = n >> 1;
793+
n >>= 1;
794794
if n == 0 { break }
795795
}
796796

@@ -989,7 +989,7 @@ impl<'w, E> StrWriterMut<'w, E> {
989989
borrow_fields!(self, self_len, self_buffer);
990990

991991
// Truncating non-ascii u8s
992-
character = character & 0b111_1111;
992+
character &= 0b111_1111;
993993

994994
let end = *self_len + repeated;
995995

const_format/src/formatting.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ pub const fn hex_as_ascii(n: u8) -> u8 {
230230
}
231231

232232
#[doc(hidden)]
233+
// Really clippy? Array indexing can panic you know.
234+
#[allow(clippy::no_effect)]
233235
pub const FOR_ESCAPING: &ForEscaping = {
234236
let mut is_backslash_escaped = 0;
235237

const_format/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@
322322
#![deny(clippy::missing_safety_doc)]
323323
#![deny(clippy::shadow_unrelated)]
324324
#![deny(clippy::wildcard_imports)]
325+
// All The methods that take self by value are for small Copy types
326+
#![allow(clippy::wrong_self_convention)]
325327
#![deny(missing_docs)]
326328

327329
include! {"const_debug_derive.rs"}

const_format/src/macros.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ macro_rules! strwriter_as_str {
257257
($expr:expr) => {
258258
unsafe {
259259
let writer: &'static $crate::StrWriter = $expr;
260-
$crate::pmr::transmute::<&'static [u8], &'static str>(writer.as_bytes_alt())
260+
#[allow(clippy::transmute_bytes_to_str)]
261+
let ret = $crate::pmr::transmute::<&'static [u8], &'static str>(writer.as_bytes_alt());
262+
ret
261263
}
262264
};
263265
}

const_format/src/marker_traits/format_marker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ macro_rules! std_kind_impls {
185185
///
186186
/// [`PWrapper`]: ../struct.PWrapper.html
187187
///
188+
#[allow(clippy::type_complexity)]
188189
pub struct IsAFormatMarker<K, T: ?Sized, R: ?Sized>(
189190
PhantomData<(
190191
PhantomData<fn() -> PhantomData<K>>,

const_format/src/marker_traits/write_marker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ where
181181
///
182182
/// [`IsNotAStrWriter`]: ./struct.IsNotAStrWriter.html
183183
///
184+
#[allow(clippy::type_complexity)]
184185
pub struct IsAWriteMarker<K, T: ?Sized, R: ?Sized>(
185186
PhantomData<(
186187
PhantomData<fn() -> PhantomData<K>>,

0 commit comments

Comments
 (0)