Skip to content

Remove unused macros from the codebase #41934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
@@ -176,18 +176,6 @@ impl<'a> Iterator for EncodeUtf16<'a> {
#[unstable(feature = "fused", issue = "35602")]
impl<'a> FusedIterator for EncodeUtf16<'a> {}

// Return the initial codepoint accumulator for the first byte.
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
// for width 3, and 3 bits for width 4
macro_rules! utf8_first_byte {
($byte:expr, $width:expr) => (($byte & (0x7F >> $width)) as u32)
}

// return the value of $ch updated with continuation byte $byte
macro_rules! utf8_acc_cont_byte {
($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63) as u32)
}

#[stable(feature = "rust1", since = "1.0.0")]
impl Borrow<str> for String {
#[inline]
4 changes: 0 additions & 4 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
@@ -104,10 +104,6 @@ mod macros;
#[macro_use]
mod internal_macros;

#[path = "num/float_macros.rs"]
#[macro_use]
mod float_macros;

#[path = "num/int_macros.rs"]
#[macro_use]
mod int_macros;
20 changes: 0 additions & 20 deletions src/libcore/num/float_macros.rs

This file was deleted.

7 changes: 0 additions & 7 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
@@ -96,13 +96,6 @@ pub mod dec2flt;
pub mod bignum;
pub mod diy_float;

macro_rules! checked_op {
($U:ty, $op:path, $x:expr, $y:expr) => {{
let (result, overflowed) = unsafe { $op($x as $U, $y as $U) };
if overflowed { None } else { Some(result as Self) }
}}
}

// `Int` + `SignedInt` implemented for signed integers
macro_rules! int_impl {
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr,
15 changes: 0 additions & 15 deletions src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
@@ -95,21 +95,6 @@ struct FileWithAnnotatedLines {
multiline_depth: usize,
}


/// Do not use this for messages that end in `\n` – use `println_maybe_styled` instead. See
/// `EmitterWriter::print_maybe_styled` for details.
macro_rules! print_maybe_styled {
($dst: expr, $style: expr, $($arg: tt)*) => {
$dst.print_maybe_styled(format_args!($($arg)*), $style, false)
}
}

macro_rules! println_maybe_styled {
($dst: expr, $style: expr, $($arg: tt)*) => {
$dst.print_maybe_styled(format_args!($($arg)*), $style, true)
}
}

impl EmitterWriter {
pub fn stderr(color_config: ColorConfig, code_map: Option<Rc<CodeMapper>>) -> EmitterWriter {
if color_config.use_color() {
1 change: 1 addition & 0 deletions src/librustc_trans/back/msvc/mod.rs
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@
//! comments can also be found below leading through the various code paths.
// A simple macro to make this option mess easier to read
#[cfg(windows)]
macro_rules! otry {
($expr:expr) => (match $expr {
Some(val) => val,
3 changes: 0 additions & 3 deletions src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
@@ -85,9 +85,6 @@ pub mod back {

pub mod diagnostics;

#[macro_use]
mod macros;

mod abi;
mod adt;
mod asm;
29 changes: 0 additions & 29 deletions src/librustc_trans/macros.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/libsyntax_ext/deriving/mod.rs
Original file line number Diff line number Diff line change
@@ -25,12 +25,6 @@ macro_rules! pathvec {
)
}

macro_rules! path {
($($x:tt)*) => (
::ext::deriving::generic::ty::Path::new( pathvec![ $($x)* ] )
)
}

macro_rules! path_local {
($x:ident) => (
::deriving::generic::ty::Path::new_local(stringify!($x))