Skip to content

Commit 67ef847

Browse files
Rollup merge of rust-lang#41934 - est31:remove_unused_macros, r=nagisa
Remove unused macros from the codebase Thanks to the lint I've implemented in rust-lang#41907 I've found some unused macros inside the rustc codebase.
2 parents 9b19970 + 80891f6 commit 67ef847

File tree

9 files changed

+1
-96
lines changed

9 files changed

+1
-96
lines changed

src/libcollections/str.rs

-12
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,6 @@ impl<'a> Iterator for EncodeUtf16<'a> {
176176
#[unstable(feature = "fused", issue = "35602")]
177177
impl<'a> FusedIterator for EncodeUtf16<'a> {}
178178

179-
// Return the initial codepoint accumulator for the first byte.
180-
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
181-
// for width 3, and 3 bits for width 4
182-
macro_rules! utf8_first_byte {
183-
($byte:expr, $width:expr) => (($byte & (0x7F >> $width)) as u32)
184-
}
185-
186-
// return the value of $ch updated with continuation byte $byte
187-
macro_rules! utf8_acc_cont_byte {
188-
($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63) as u32)
189-
}
190-
191179
#[stable(feature = "rust1", since = "1.0.0")]
192180
impl Borrow<str> for String {
193181
#[inline]

src/libcore/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ mod macros;
104104
#[macro_use]
105105
mod internal_macros;
106106

107-
#[path = "num/float_macros.rs"]
108-
#[macro_use]
109-
mod float_macros;
110-
111107
#[path = "num/int_macros.rs"]
112108
#[macro_use]
113109
mod int_macros;

src/libcore/num/float_macros.rs

-20
This file was deleted.

src/libcore/num/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ pub mod dec2flt;
9696
pub mod bignum;
9797
pub mod diy_float;
9898

99-
macro_rules! checked_op {
100-
($U:ty, $op:path, $x:expr, $y:expr) => {{
101-
let (result, overflowed) = unsafe { $op($x as $U, $y as $U) };
102-
if overflowed { None } else { Some(result as Self) }
103-
}}
104-
}
105-
10699
// `Int` + `SignedInt` implemented for signed integers
107100
macro_rules! int_impl {
108101
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr,

src/librustc_errors/emitter.rs

-15
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,6 @@ struct FileWithAnnotatedLines {
9595
multiline_depth: usize,
9696
}
9797

98-
99-
/// Do not use this for messages that end in `\n` – use `println_maybe_styled` instead. See
100-
/// `EmitterWriter::print_maybe_styled` for details.
101-
macro_rules! print_maybe_styled {
102-
($dst: expr, $style: expr, $($arg: tt)*) => {
103-
$dst.print_maybe_styled(format_args!($($arg)*), $style, false)
104-
}
105-
}
106-
107-
macro_rules! println_maybe_styled {
108-
($dst: expr, $style: expr, $($arg: tt)*) => {
109-
$dst.print_maybe_styled(format_args!($($arg)*), $style, true)
110-
}
111-
}
112-
11398
impl EmitterWriter {
11499
pub fn stderr(color_config: ColorConfig, code_map: Option<Rc<CodeMapper>>) -> EmitterWriter {
115100
if color_config.use_color() {

src/librustc_trans/back/msvc/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
//! comments can also be found below leading through the various code paths.
3333
3434
// A simple macro to make this option mess easier to read
35+
#[cfg(windows)]
3536
macro_rules! otry {
3637
($expr:expr) => (match $expr {
3738
Some(val) => val,

src/librustc_trans/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ pub mod back {
8686

8787
pub mod diagnostics;
8888

89-
#[macro_use]
90-
mod macros;
91-
9289
mod abi;
9390
mod adt;
9491
mod asm;

src/librustc_trans/macros.rs

-29
This file was deleted.

src/libsyntax_ext/deriving/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ macro_rules! pathvec {
2525
)
2626
}
2727

28-
macro_rules! path {
29-
($($x:tt)*) => (
30-
::ext::deriving::generic::ty::Path::new( pathvec![ $($x)* ] )
31-
)
32-
}
33-
3428
macro_rules! path_local {
3529
($x:ident) => (
3630
::deriving::generic::ty::Path::new_local(stringify!($x))

0 commit comments

Comments
 (0)