file_name
large_stringlengths
4
69
prefix
large_stringlengths
0
26.7k
suffix
large_stringlengths
0
24.8k
middle
large_stringlengths
0
2.12k
fim_type
large_stringclasses
4 values
cloudformation.rs
#![cfg(feature = "cloudformation")] extern crate rusoto; use rusoto::cloudformation::{CloudFormationClient, ListStacksInput}; use rusoto::{DefaultCredentialsProvider, Region}; use rusoto::default_tls_client; #[test] fn
() { let client = CloudFormationClient::new(default_tls_client().unwrap(), DefaultCredentialsProvider::new().unwrap(), Region::UsEast1); let request = ListStacksInput::default(); let result = client.list_stacks(&request).unwrap(); println!("{:#?}", result); } #[test] fn should_list_stacks_with_status_...
should_list_stacks
identifier_name
paths.rs
use std::env; use std::ffi::{OsStr, OsString}; use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf, Component}; use util::{human, internal, CargoResult, ChainError}; pub fn join_paths<T: AsRef<OsStr>>(paths: &[T], env: &str) -> CargoResult<OsString> { env::join_paths(paths.iter()).or_else(|e...
() -> &'static str { if cfg!(windows) {"PATH"} else if cfg!(target_os = "macos") {"DYLD_LIBRARY_PATH"} else {"LD_LIBRARY_PATH"} } pub fn dylib_path() -> Vec<PathBuf> { match env::var_os(dylib_path_envvar()) { Some(var) => env::split_paths(&var).collect(), None => Vec::new(), } } pu...
dylib_path_envvar
identifier_name
paths.rs
use std::env; use std::ffi::{OsStr, OsString}; use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf, Component}; use util::{human, internal, CargoResult, ChainError}; pub fn join_paths<T: AsRef<OsStr>>(paths: &[T], env: &str) -> CargoResult<OsString> { env::join_paths(paths.iter()).or_else(|e...
#[cfg(windows)] pub fn bytes2path(bytes: &[u8]) -> CargoResult<PathBuf> { use std::str; match str::from_utf8(bytes) { Ok(s) => Ok(PathBuf::from(s)), Err(..) => Err(human("invalid non-unicode path")), } }
{ use std::os::unix::prelude::*; use std::ffi::OsStr; Ok(PathBuf::from(OsStr::from_bytes(bytes))) }
identifier_body
paths.rs
use std::env; use std::ffi::{OsStr, OsString}; use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf, Component}; use util::{human, internal, CargoResult, ChainError}; pub fn join_paths<T: AsRef<OsStr>>(paths: &[T], env: &str) -> CargoResult<OsString> { env::join_paths(paths.iter()).or_else(|e...
else if cfg!(target_os = "macos") {"DYLD_LIBRARY_PATH"} else {"LD_LIBRARY_PATH"} } pub fn dylib_path() -> Vec<PathBuf> { match env::var_os(dylib_path_envvar()) { Some(var) => env::split_paths(&var).collect(), None => Vec::new(), } } pub fn normalize_path(path: &Path) -> PathBuf { ...
{"PATH"}
conditional_block
paths.rs
use std::env; use std::ffi::{OsStr, OsString}; use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf, Component}; use util::{human, internal, CargoResult, ChainError}; pub fn join_paths<T: AsRef<OsStr>>(paths: &[T], env: &str) -> CargoResult<OsString> { env::join_paths(paths.iter()).or_else(|e...
if cfg!(windows) {"PATH"} else if cfg!(target_os = "macos") {"DYLD_LIBRARY_PATH"} else {"LD_LIBRARY_PATH"} } pub fn dylib_path() -> Vec<PathBuf> { match env::var_os(dylib_path_envvar()) { Some(var) => env::split_paths(&var).collect(), None => Vec::new(), } } pub fn normalize_path(p...
pub fn dylib_path_envvar() -> &'static str {
random_line_split
mod.rs
mod pic; #[macro_use] mod macros; use x86; use drivers; use vga_buffer; use kernel::kget; use schedule::task::TaskContext; use x86_64::structures::idt::{ExceptionStackFrame, Idt, PageFaultErrorCode}; lazy_static! { static ref IDT: Idt = { let mut idt = Idt::new(); // Set all the handlers. Set ...
/// Initialises the PIC and IDT. Enables CPU interrupts. pub fn init() { PIC.init(); // Enable some pic interrupts PIC.clear_mask(0); PIC.clear_mask(1); // PIC.clear_mask(2); // PIC.clear_mask(3); // PIC.clear_mask(4); // PIC.clear_mask(5); IDT.load(); // Enable interrupts ...
static PIC: pic::Pic = pic::Pic::new(); /// Initialise kernel interrupt handling ///
random_line_split
mod.rs
mod pic; #[macro_use] mod macros; use x86; use drivers; use vga_buffer; use kernel::kget; use schedule::task::TaskContext; use x86_64::structures::idt::{ExceptionStackFrame, Idt, PageFaultErrorCode}; lazy_static! { static ref IDT: Idt = { let mut idt = Idt::new(); // Set all the handlers. Set ...
( stack_frame: &mut ExceptionStackFrame, error_code: PageFaultErrorCode, ) { unsafe { vga_buffer::print_error(format_args!( "EXCEPTION: Page Fault accessing {:#x} \nerror code: {:?}\n{:#?}", x86::controlregs::cr2(), error_code, stack_frame.instruction_...
except_14
identifier_name
mod.rs
mod pic; #[macro_use] mod macros; use x86; use drivers; use vga_buffer; use kernel::kget; use schedule::task::TaskContext; use x86_64::structures::idt::{ExceptionStackFrame, Idt, PageFaultErrorCode}; lazy_static! { static ref IDT: Idt = { let mut idt = Idt::new(); // Set all the handlers. Set ...
/// Handler for IRQ1 - The keyboard interrupt /// /// Instantiates and queues up a new keyboard driver bottom half. unsafe fn irq1() { let scheduler = &*kget().scheduler.get(); let bh_manager = scheduler.bh_manager(); let bh = box drivers::KeyboardBottomHalf::new(); bh_manager.add_bh(bh); }
{ let clock = &mut *kget().clock.get(); clock.tick(); }
identifier_body
lib.rs
, such that the oldest modified file is returned first. fn get_all_files<P: AsRef<Path>>(path: P) -> Box<dyn Iterator<Item = (PathBuf, u64)>> { let mut files: Vec<_> = WalkDir::new(path.as_ref()) .into_iter() .filter_map(|e| { e.ok().and_then(|f| { // Only look at files ...
} Ok(self) } /// Returns `true` if the disk cache can store a file of `size` bytes. pub fn can_store(&self, size: u64) -> bool { size <= self.lru.capacity() as u64 } /// Add the file at `path` of size `size` to the cache. fn add_file(&mut self, addfile_path: AddFile<'_...
{ self.add_file(AddFile::AbsPath(file), size) .unwrap_or_else(|e| error!("Error adding file: {}", e)); }
conditional_block
lib.rs
, such that the oldest modified file is returned first. fn get_all_files<P: AsRef<Path>>(path: P) -> Box<dyn Iterator<Item = (PathBuf, u64)>> { let mut files: Vec<_> = WalkDir::new(path.as_ref()) .into_iter() .filter_map(|e| { e.ok().and_then(|f| { // Only look at files ...
<R: Read>(r: &mut R) -> io::Result<Vec<u8>> { let mut v = vec![]; r.read_to_end(&mut v)?; Ok(v) } impl TestFixture { pub fn new() -> TestFixture { TestFixture { tempdir: tempfile::Builder::new() .prefix("lru-disk-cache-test") ...
read_all
identifier_name
lib.rs
time, such that the oldest modified file is returned first. fn get_all_files<P: AsRef<Path>>(path: P) -> Box<dyn Iterator<Item = (PathBuf, u64)>> { let mut files: Vec<_> = WalkDir::new(path.as_ref()) .into_iter() .filter_map(|e| { e.ok().and_then(|f| { // Only look at file...
} impl TestFixture { pub fn new() -> TestFixture { TestFixture { tempdir: tempfile::Builder::new() .prefix("lru-disk-cache-test") .tempdir() .unwrap(), } } pub fn tmp(&self) -> &Path { ...
random_line_split
lib.rs
, such that the oldest modified file is returned first. fn get_all_files<P: AsRef<Path>>(path: P) -> Box<dyn Iterator<Item = (PathBuf, u64)>> { let mut files: Vec<_> = WalkDir::new(path.as_ref()) .into_iter() .filter_map(|e| { e.ok().and_then(|f| { // Only look at files ...
} impl From<io::Error> for Error { fn from(e: io::Error) -> Error { Error::Io(e) } } /// A convenience `Result` type pub type Result<T> = std::result::Result<T, Error>; /// Trait objects can't be bounded by more than one non-builtin trait. pub trait ReadSeek: Read + Seek + Send {} impl<T: Read + Se...
{ match self { Error::FileTooLarge => None, Error::FileNotInCache => None, Error::Io(ref e) => Some(e), } }
identifier_body
extern.rs
extern "C" {
fn c_func(x: *mut *mut libc::c_void); fn c_func(x: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, y: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY); #[test123] fn foo() -> uint64_t; pub fn bar() ; } extern { fn DMR_GetDevice(pHDev: *mut HDEV, searchMode: DeviceSearchMode, pSearchString: *const c_char, ...
random_line_split
main.rs
#![cfg_attr(feature = "nightly-testing", feature(plugin))] mod botocore; mod cargo; mod commands; mod config; mod doco; mod service; mod util; use std::path::Path; use clap::{crate_authors, crate_description, crate_version, App, Arg, SubCommand}; use crate::botocore::ServiceDefinition; use crate::config::ServiceCon...
}
random_line_split
main.rs
#![cfg_attr(feature = "nightly-testing", feature(plugin))] mod botocore; mod cargo; mod commands; mod config; mod doco; mod service; mod util; use std::path::Path; use clap::{crate_authors, crate_description, crate_version, App, Arg, SubCommand}; use crate::botocore::ServiceDefinition; use crate::config::ServiceCon...
) .arg( Arg::with_name("out_dir") .long("outdir") .short("o") .takes_value(true) .required(true), ) .arg( Arg::with_name("serv...
{ let matches = App::new("Rusoto Service Crate Generator") .version(crate_version!()) .author(crate_authors!()) .about(crate_description!()) .subcommand( SubCommand::with_name("check").arg( Arg::with_name("services_config") .long("confi...
identifier_body
main.rs
#![cfg_attr(feature = "nightly-testing", feature(plugin))] mod botocore; mod cargo; mod commands; mod config; mod doco; mod service; mod util; use std::path::Path; use clap::{crate_authors, crate_description, crate_version, App, Arg, SubCommand}; use crate::botocore::ServiceDefinition; use crate::config::ServiceCon...
() { let matches = App::new("Rusoto Service Crate Generator") .version(crate_version!()) .author(crate_authors!()) .about(crate_description!()) .subcommand( SubCommand::with_name("check").arg( Arg::with_name("services_config") .long("config"...
main
identifier_name
main.rs
#![cfg_attr(feature = "nightly-testing", feature(plugin))] mod botocore; mod cargo; mod commands; mod config; mod doco; mod service; mod util; use std::path::Path; use clap::{crate_authors, crate_description, crate_version, App, Arg, SubCommand}; use crate::botocore::ServiceDefinition; use crate::config::ServiceCon...
if let Some(matches) = matches.subcommand_matches("generate") { let services_config_path = matches.value_of("services_config").unwrap(); let service_configs = ServiceConfig::load_all(services_config_path) .expect("Unable to read services configuration file."); let out_dir = Pat...
{ let services_config_path = matches.value_of("services_config").unwrap(); let service_configs = ServiceConfig::load_all(services_config_path) .expect("Unable to read services configuration file."); commands::check::check(service_configs); }
conditional_block
slice-panic-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn foo() { let x: &[_] = &[Foo, Foo]; &x[3..4]; } fn main() { let _ = thread::spawn(move|| foo()).join(); unsafe { assert!(DTOR_COUNT == 2); } }
{ unsafe { DTOR_COUNT += 1; } }
identifier_body
slice-panic-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let x: &[_] = &[Foo, Foo]; &x[3..4]; } fn main() { let _ = thread::spawn(move|| foo()).join(); unsafe { assert!(DTOR_COUNT == 2); } }
foo
identifier_name
slice-panic-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn drop(&mut self) { unsafe { DTOR_COUNT += 1; } } } fn foo() { let x: &[_] = &[Foo, Foo]; &x[3..4]; } fn main() { let _ = thread::spawn(move|| foo()).join(); unsafe { assert!(DTOR_COUNT == 2); } }
struct Foo; static mut DTOR_COUNT: isize = 0; impl Drop for Foo {
random_line_split
raw.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { use os::windows::raw; } }
windows
identifier_name
raw.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#[cfg(windows)] fn windows() { use os::windows::raw; } }
ok_size!(stat); } }
random_line_split
raw.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#[cfg(unix)] fn unix() { { use os::unix::raw; ok!(uid_t gid_t dev_t ino_t mode_t nlink_t off_t blksize_t blkcnt_t); } { use sys::platform::raw; ok_size!(stat); } } #[cfg(windows)] fn windows() { use os::window...
{ use os::raw; ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_float c_double); }
identifier_body
issue-9129.rs
// run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(deprecated)] // llvm_asm! // ignore-pretty unreported #![feature(box_syntax)] pub trait bomb { fn boom(&self, _: Ident); } pub struct S; impl bomb for S { fn
(&self, _: Ident) { } } pub struct Ident { name: usize } // macro_rules! int3 { () => ( unsafe { llvm_asm!( "int3" ); } ) } macro_rules! int3 { () => ( { } ) } fn Ident_new() -> Ident { int3!(); Ident {name: 0x6789ABCD } } pub fn light_fuse(fld: Box<dyn bomb>) { int3!(); let f = || { int3!()...
boom
identifier_name
issue-9129.rs
// run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(deprecated)] // llvm_asm! // ignore-pretty unreported #![feature(box_syntax)] pub trait bomb { fn boom(&self, _: Ident); } pub struct S; impl bomb for S { fn boom(&self, _: Ident) { } } pub struct Ident { name: usize ...
pub fn light_fuse(fld: Box<dyn bomb>) { int3!(); let f = || { int3!(); fld.boom(Ident_new()); // *** 1 }; f(); } pub fn main() { let b = box S as Box<dyn bomb>; light_fuse(b); }
{ int3!(); Ident {name: 0x6789ABCD } }
identifier_body
issue-9129.rs
// run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(deprecated)] // llvm_asm! // ignore-pretty unreported #![feature(box_syntax)]
pub struct S; impl bomb for S { fn boom(&self, _: Ident) { } } pub struct Ident { name: usize } // macro_rules! int3 { () => ( unsafe { llvm_asm!( "int3" ); } ) } macro_rules! int3 { () => ( { } ) } fn Ident_new() -> Ident { int3!(); Ident {name: 0x6789ABCD } } pub fn light_fuse(fld: Box<dyn bomb>) { in...
pub trait bomb { fn boom(&self, _: Ident); }
random_line_split
modulo_arithmetic_float.rs
#![warn(clippy::modulo_arithmetic)] #![allow( unused, clippy::shadow_reuse, clippy::shadow_unrelated, clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one )] fn main()
// No lint when both sides are const and of the same sign 1.6 % 2.1; -1.6 % -2.1; (1.1 + 2.3) % (-1.1 + 2.3); (-1.1 - 2.3) % (1.1 - 2.3); }
{ // Lint when both sides are const and of the opposite sign -1.6 % 2.1; 1.6 % -2.1; (1.1 - 2.3) % (1.1 + 2.3); (1.1 + 2.3) % (1.1 - 2.3); // Lint on floating point numbers let a_f32: f32 = -1.6; let mut b_f32: f32 = 2.1; a_f32 % b_f32; b_f32 % a_f32; b_f32 %= a_f32; le...
identifier_body
modulo_arithmetic_float.rs
#![warn(clippy::modulo_arithmetic)] #![allow( unused, clippy::shadow_reuse, clippy::shadow_unrelated, clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one )] fn
() { // Lint when both sides are const and of the opposite sign -1.6 % 2.1; 1.6 % -2.1; (1.1 - 2.3) % (1.1 + 2.3); (1.1 + 2.3) % (1.1 - 2.3); // Lint on floating point numbers let a_f32: f32 = -1.6; let mut b_f32: f32 = 2.1; a_f32 % b_f32; b_f32 % a_f32; b_f32 %= a_f32; ...
main
identifier_name
modulo_arithmetic_float.rs
#![warn(clippy::modulo_arithmetic)] #![allow( unused, clippy::shadow_reuse, clippy::shadow_unrelated, clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one )] fn main() { // Lint when both sides are const and of the opposite sign -1.6 % 2.1; 1.6 % -2.1; (1.1 - 2.3...
(1.1 + 2.3) % (-1.1 + 2.3); (-1.1 - 2.3) % (1.1 - 2.3); }
-1.6 % -2.1;
random_line_split
deriving-span-PartialOrd-struct.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ x: Error //~ ERROR //~^ ERROR //~^^ ERROR //~^^^ ERROR //~^^^^ ERROR //~^^^^^ ERROR //~^^^^^^ ERROR //~^^^^^^^ ERROR //~^^^^^^^^ ERROR } fn main() {}
Struct
identifier_name
deriving-span-PartialOrd-struct.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
//~^^^ ERROR //~^^^^ ERROR //~^^^^^ ERROR //~^^^^^^ ERROR //~^^^^^^^ ERROR //~^^^^^^^^ ERROR } fn main() {}
//~^^ ERROR
random_line_split
core_thread.rs
use modulo_traits::core_msg::ToCoreThreadMsg; use modulo_traits::file_msg::{FileThreadId, ToFileThreadMsg}; use file::file_thread::FileThread; use std::collections::HashMap; use std::path::PathBuf; use std::sync::mpsc::{self, Sender, Receiver}; use std::thread::{self, JoinHandle}; pub struct Core { file_threads: H...
impl Core { pub fn start() -> (Sender<ToCoreThreadMsg>, JoinHandle<()>) { let (sender, receiver) = mpsc::channel(); let file_sender = sender.clone(); let handle = thread::spawn(move || { let mut core = Core { file_threads: HashMap::new(), file_rec...
file_id_counter: usize, }
random_line_split
core_thread.rs
use modulo_traits::core_msg::ToCoreThreadMsg; use modulo_traits::file_msg::{FileThreadId, ToFileThreadMsg}; use file::file_thread::FileThread; use std::collections::HashMap; use std::path::PathBuf; use std::sync::mpsc::{self, Sender, Receiver}; use std::thread::{self, JoinHandle}; pub struct Core { file_threads: H...
}
{ let (sender, receiver) = mpsc::channel(); let id = FileThreadId(self.file_id_counter); FileThread::start(id, path, self.file_sender.clone(), receiver); self.file_threads.insert(id, sender); self.file_...
identifier_body
core_thread.rs
use modulo_traits::core_msg::ToCoreThreadMsg; use modulo_traits::file_msg::{FileThreadId, ToFileThreadMsg}; use file::file_thread::FileThread; use std::collections::HashMap; use std::path::PathBuf; use std::sync::mpsc::{self, Sender, Receiver}; use std::thread::{self, JoinHandle}; pub struct
{ file_threads: HashMap<FileThreadId, Sender<ToFileThreadMsg>>, file_receiver: Receiver<ToCoreThreadMsg>, file_sender: Sender<ToCoreThreadMsg>, file_id_counter: usize, } impl Core { pub fn start() -> (Sender<ToCoreThreadMsg>, JoinHandle<()>) { let (sender, receiver) = mpsc::channel(); ...
Core
identifier_name
authz_error.rs
use url::Url; #[derive(Clone, Copy, Debug, PartialEq, Deserialize)] pub enum AuthzErrorCode { #[serde(rename="invalid_request")] InvalidRequest, #[serde(rename="unauthorized_client")] UnauthorizedClient, #[serde(rename="access_denied")] AccessDenied, #[serde(rename="unsupported_response_typ...
ServerError, #[serde(rename="temporarily_unavailable")] TemporarilyUnavailable } impl From<AuthzErrorCode> for &'static str { fn from(e: AuthzErrorCode) -> &'static str { match e { AuthzErrorCode::InvalidRequest => "invalid_request", AuthzErrorCode::UnauthorizedClient =>...
InvalidScope, #[serde(rename="server_error")]
random_line_split
authz_error.rs
use url::Url; #[derive(Clone, Copy, Debug, PartialEq, Deserialize)] pub enum AuthzErrorCode { #[serde(rename="invalid_request")] InvalidRequest, #[serde(rename="unauthorized_client")] UnauthorizedClient, #[serde(rename="access_denied")] AccessDenied, #[serde(rename="unsupported_response_ty...
}
{ url.query_pairs_mut() .append_pair("error", <&'static str as From<AuthzErrorCode>>::from(self.error)); if self.error_description.is_some() { url.query_pairs_mut() .append_pair("error_description", self.error_description.as_ref().unwrap()); } if s...
identifier_body
authz_error.rs
use url::Url; #[derive(Clone, Copy, Debug, PartialEq, Deserialize)] pub enum AuthzErrorCode { #[serde(rename="invalid_request")] InvalidRequest, #[serde(rename="unauthorized_client")] UnauthorizedClient, #[serde(rename="access_denied")] AccessDenied, #[serde(rename="unsupported_response_ty...
(&self, url: &mut Url) { url.query_pairs_mut() .append_pair("error", <&'static str as From<AuthzErrorCode>>::from(self.error)); if self.error_description.is_some() { url.query_pairs_mut() .append_pair("error_description", self.error_description.as_ref().unwrap()); ...
put_into_query_string
identifier_name
error.rs
use http; use hyper::Error as HttpError; use serde_json::Error as JsonError; use serde_yaml::Error as YamlError; use std::error::Error as StdError; use std::fmt::{Display, Error as FmtError, Formatter}; use std::io::{Error as IOError, ErrorKind}; use url::ParseError; #[derive(Debug)] pub enum Error { Io(IOError), ...
} impl From<http::Error> for Error { fn from(e: http::Error) -> Error { Error::Http(format!("{}", e)) } }
{ Error::Other(msg.to_owned()) }
identifier_body
error.rs
use http; use hyper::Error as HttpError; use serde_json::Error as JsonError; use serde_yaml::Error as YamlError; use std::error::Error as StdError; use std::fmt::{Display, Error as FmtError, Formatter}; use std::io::{Error as IOError, ErrorKind}; use url::ParseError; #[derive(Debug)] pub enum Error { Io(IOError), ...
(err: JsonError) -> Error { Error::Serialize(format!("{}", err)) } } impl From<YamlError> for Error { fn from(err: YamlError) -> Error { Error::Serialize(format!("{}", err)) } } impl From<ParseError> for Error { fn from(err: ParseError) -> Error { Error::Other(format!("parse ur...
from
identifier_name
error.rs
use http; use hyper::Error as HttpError; use serde_json::Error as JsonError; use serde_yaml::Error as YamlError; use std::error::Error as StdError; use std::fmt::{Display, Error as FmtError, Formatter}; use std::io::{Error as IOError, ErrorKind}; use url::ParseError; #[derive(Debug)] pub enum Error { Io(IOError), ...
pub fn can_retry(&self) -> bool { match self { Error::Ssl(_) => false, Error::Serialize(_) => false, Error::Request(code, _) => matches!( code.as_str(), "SYSTEM_ERROR" | "TOO_MANY_ATTEMPTS" | "DEADLINE_EXCEEDED" | "CANCELLED" )...
} false }
random_line_split
typestate-cfg-nesting.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { let x = 10; let mut y = 11; if true { while false { y = x; } } else { } }
{ let x = 10; let mut y = 11; if true { match x { _ => { y = x; } } } else { } }
identifier_body
typestate-cfg-nesting.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let x = 10; let mut y = 11; if true { while false { y = x; } } else { } }
main
identifier_name
typestate-cfg-nesting.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} pub fn main() { let x = 10; let mut y = 11; if true { while false { y = x; } } else { } }
{ }
conditional_block
typestate-cfg-nesting.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn f() { let x = 10; let mut y = 11; if true { match x { _ => { y = x; } } } else { } } pub fn main() { let x = 10; let mut y = 11; if true { while false { y = x; } } else { } }
#![allow(dead_assignment)] #![allow(unused_variable)]
random_line_split
lib.rs
#![allow(non_upper_case_globals)] // External crates #[macro_use] extern crate clap; extern crate num_cpus; extern crate num; extern crate time; // External modules use clap::App; use num::complex::Complex64; use time::{precise_time_ns}; // Rust modules use std::fs::File; use std::io::prelude::Write; use std::io::Re...
{ pub re1: f64, pub re2: f64, pub img1: f64, pub img2: f64, pub x_step: f64, pub y_step: f64, pub max_iter: u32, pub img_size: u32, pub write_metadata: bool, pub no_ppm: bool, pub num_threads: u32, pub num_of_runs: u32 } include!(concat!(env!("OUT_DIR"), "/compiler_vers...
MandelConfig
identifier_name
lib.rs
#![allow(non_upper_case_globals)] // External crates #[macro_use] extern crate clap; extern crate num_cpus; extern crate num; extern crate time; // External modules use clap::App; use num::complex::Complex64; use time::{precise_time_ns}; // Rust modules use std::fs::File; use std::io::prelude::Write; use std::io::Re...
--write_metadata 'write metadata like run time into the ppm file (default: off)' --no_ppm 'disable creation of the ppm file, just run the calculation (default: off)' --bench 'use all available CPUs (default: off), will change in the future' --max_iter=[MAX_ITER]'maxim...
--re2=[REAL2] 'right real part (default: 1.0)' --img1=[IMAGINARY1] 'lower part (default: -1.50)' --img2=[IMAGINARY2] 'upper part (default: 1.50)'
random_line_split
lib.rs
#![allow(non_upper_case_globals)] // External crates #[macro_use] extern crate clap; extern crate num_cpus; extern crate num; extern crate time; // External modules use clap::App; use num::complex::Complex64; use time::{precise_time_ns}; // Rust modules use std::fs::File; use std::io::prelude::Write; use std::io::Re...
try!(write!(buffer, "{0} {0}\n", mandel_config.img_size)); try!(buffer.write(b"255\n")); let mut img_value: u32; for y in 0..mandel_config.img_size { for x in 0..mandel_config.img_size { img_value = image[((y * mandel_config.img_size) + x) as usize]; if img_value == m...
{ // TODO: add more meta data: date and time, method, ... try!(write!(buffer, "# computation time: {} ms\n", time_in_ms)); }
conditional_block
check_tx.rs
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
fn check_tx_cache(bencher: &mut Bencher) { let blockchain = prepare_blockchain(); let transactions = prepare_transactions(128); let snapshot = blockchain.snapshot(); bencher.iter_batched( TxCheckCache::new, |mut cache| { assert!(transactions .iter() ...
{ let blockchain = prepare_blockchain(); let transactions = prepare_transactions(128); let snapshot = blockchain.snapshot(); bencher.iter(|| { assert!(transactions .iter() .all(|tx| Blockchain::check_tx(&snapshot, tx).is_ok())); }) }
identifier_body
check_tx.rs
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
let mut rng = StdRng::seed_from_u64(RNG_SEED); (0..count) .map(|_| { let mut payload = [0_u8; 64]; rng.fill(&mut payload[..]); let payload = AnyTx::new(CallInfo::new(100, 0), payload.to_vec()); payload.sign_with_keypair(&KeyPair::random()) }) ...
fn prepare_transactions(count: usize) -> Vec<Verified<AnyTx>> { const RNG_SEED: u64 = 123_456_789;
random_line_split
check_tx.rs
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
(&mut self, _artifact: ArtifactId, _deploy_spec: Vec<u8>) -> Receiver { Receiver::with_result(Ok(())) } fn is_artifact_deployed(&self, _artifact: &ArtifactId) -> bool { true } fn initiate_adding_service( &self, _context: ExecutionContext<'_>, _artifact: &Artifac...
deploy_artifact
identifier_name
main.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #![deny(clippy::all)] use clap::Parser; use colored::Colorize; use signedsource::{sign_file, SIGNING_TOKEN}; use std::collection...
", signing_token = SIGNING_TOKEN, ) } else { format!( "// {signing_token} // Generated by $ cargo run -p fixture-tests -- {dir_name} ", signing_token = SIGNING_TOKEN, dir_name = dir.display(), ) }; ...
* * {signing_token} */
random_line_split
main.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #![deny(clippy::all)] use clap::Parser; use colored::Colorize; use signedsource::{sign_file, SIGNING_TOKEN}; use std::collection...
else { if let Some(ref previous) = test_case.input { panic!("Conflicting fixture name, {:?} and {:?}", previous, path); } test_case.input = Some(path); } } for mut test_case in test_cases.values_mut() { if test_...
{ if let Some(ref previous) = test_case.expected { panic!("Conflicting fixture name, {:?} and {:?}", previous, path); } test_case.expected = Some(path); }
conditional_block
main.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #![deny(clippy::all)] use clap::Parser; use colored::Colorize; use signedsource::{sign_file, SIGNING_TOKEN}; use std::collection...
{ /// List of directories, each should contain a `/fixtures` subdirectory /// from which a test file will be generated #[clap(name = "DIR", parse(from_os_str))] dirs: Vec<PathBuf>, } #[derive(Debug)] struct TestCase { name: String, input: Option<PathBuf>, expected: Option<PathBuf>, } cons...
Options
identifier_name
sync-send-iterators-in-libcore.rs
// run-pass // pretty-expanded FIXME #23616 #![allow(warnings)] use std::iter::{empty, once, repeat}; fn is_sync<T>(_: T) where T: Sync {} fn
<T>(_: T) where T: Send {} macro_rules! all_sync_send { ($ctor:expr, $iter:ident) => ({ let mut x = $ctor; is_sync(x.$iter()); let mut y = $ctor; is_send(y.$iter()); }); ($ctor:expr, $iter:ident($($param:expr),+)) => ({ let mut x = $ctor; is_sync(x.$iter($( $...
is_send
identifier_name
sync-send-iterators-in-libcore.rs
// run-pass // pretty-expanded FIXME #23616 #![allow(warnings)] use std::iter::{empty, once, repeat}; fn is_sync<T>(_: T) where T: Sync
fn is_send<T>(_: T) where T: Send {} macro_rules! all_sync_send { ($ctor:expr, $iter:ident) => ({ let mut x = $ctor; is_sync(x.$iter()); let mut y = $ctor; is_send(y.$iter()); }); ($ctor:expr, $iter:ident($($param:expr),+)) => ({ let mut x = $ctor; is_sync(x...
{}
identifier_body
sync-send-iterators-in-libcore.rs
// run-pass // pretty-expanded FIXME #23616 #![allow(warnings)] use std::iter::{empty, once, repeat}; fn is_sync<T>(_: T) where T: Sync {} fn is_send<T>(_: T) where T: Send {} macro_rules! all_sync_send { ($ctor:expr, $iter:ident) => ({ let mut x = $ctor; is_sync(x.$iter()); let mut y = ...
is_sync_send!((1..).step_by(2)); is_sync_send!((1..2).step_by(2)); is_sync_send!((1..2)); is_sync_send!((1..)); is_sync_send!(repeat(1)); is_sync_send!(empty::<usize>()); is_sync_send!(empty::<*mut i32>()); is_sync_send!(once(1)); // for option.rs // FIXME // for result.rs ...
random_line_split
associated-types-normalize-in-bounds-binding.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<T>() where T : FnLike<u32, R=bool> {} fn main() { }
bar
identifier_name
associated-types-normalize-in-bounds-binding.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn main() { }
random_line_split
associated-types-normalize-in-bounds-binding.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ }
identifier_body
issue-18685.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self) {} } fn main() { ().bar(); }
foo
identifier_name
issue-18685.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
().bar(); }
fn foo(&self) {} } fn main() {
random_line_split
issue-18685.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn main() { ().bar(); }
{}
identifier_body
mod.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() {} #[cfg(unix)] fn ignore_sigpipe() { use libc; use libc::funcs::posix01::signal::signal; unsafe { assert!(signal(libc::SIGPIPE, libc::SIG_IGN)!=!0); } } ignore_sigpipe(); // Store our args if necessary in a squirreled a...
ignore_sigpipe
identifier_name
mod.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else {Err(())} } /// One-time runtime cleanup. /// /// This function is unsafe because it performs no checks to ensure that the /// runtime has completely ceased running. It is the responsibility of the /// caller to ensure that the runtime is entirely shut down and nothing will be /// poking around at the internal c...
{Ok(())}
conditional_block
mod.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
ignore_sigpipe(); // Store our args if necessary in a squirreled away location args::init(argc, argv); // And finally, let's run some code! let res = unwind::try(|| { let main: fn() = mem::transmute(main); main(); }); cleanup(); ...
{ use libc; use libc::funcs::posix01::signal::signal; unsafe { assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0); } }
identifier_body
mod.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// want! // // Hence, we set SIGPIPE to ignore when the program starts up in order // to prevent this problem. #[cfg(windows)] fn ignore_sigpipe() {} #[cfg(unix)] fn ignore_sigpipe() { use libc; use libc::funcs::posix01::signal::signal; ...
// handler, causing it to kill the program, which isn't exactly what we
random_line_split
greed.rs
use std::collections::HashMap; use std::collections::hash_map; use std::default::Default; use std::cmp::Ordering; use std::fmt; use ::rand::{thread_rng, Rng, Rand}; use ::rand::distributions::{Sample, Range}; use irc::legacy::{ ChannelId, User, UserId, }; use irc::{IrcMsg, server}; use irc::legacy::Messa...
} impl GreedPlugin { pub fn new() -> GreedPlugin { GreedPlugin { games: HashMap::new(), userstats: HashMap::new(), } } pub fn get_plugin_name() -> &'static str { "greed" } fn dispatch_cmd_greed_stats(&mut self, m: &CommandMapperDispatch, msg: ...
{ write!(f, "{} wins over {} games; points: {}", self.wins, self.games, self.score_sum - self.opponent_score_sum) }
identifier_body
greed.rs
use std::collections::HashMap; use std::collections::hash_map; use std::default::Default; use std::cmp::Ordering; use std::fmt; use ::rand::{thread_rng, Rng, Rand}; use ::rand::distributions::{Sample, Range}; use irc::legacy::{ ChannelId, User, UserId, }; use irc::{IrcMsg, server}; use irc::legacy::Messa...
() -> &'static str { "greed" } fn dispatch_cmd_greed_stats(&mut self, m: &CommandMapperDispatch, msg: &server::Privmsg) { let user_id = match m.source { KnownUser(user_id) => user_id, _ => return }; m.reply(match self.userstats.get(&user_id) { ...
get_plugin_name
identifier_name
greed.rs
use std::collections::HashMap; use std::collections::hash_map; use std::default::Default; use std::cmp::Ordering; use std::fmt; use ::rand::{thread_rng, Rng, Rand}; use ::rand::distributions::{Sample, Range}; use irc::legacy::{ ChannelId, User, UserId, }; use irc::{IrcMsg, server}; use irc::legacy::Messa...
let prev_play_nick = m.get_state().resolve_user(prev_play.user_id) .and_then(|user: &User| Some(user.get_nick().to_string())) .unwrap_or_else(|| format!("{} (deceased)", prev_play.user_nick)); let prev_play_score = prev_play.roll.total_score(); let cur_...
random_line_split
population_builder.rs
//! This module defines helper functions (builder pattern) to create a valid population. //! //! darwin-rs: evolutionary algorithms with Rust //! //! Written by Willi Kappler, Version 0.4 (2017.06.26) //! //! Repository: https://github.com/willi-kappler/darwin-rs //! //! License: MIT //! //! This library allows you to ...
/// Sets the initial population provided inside a vector, length must be >= 3 pub fn initial_population(mut self, individuals: &[T]) -> PopulationBuilder<T> { self.population.num_of_individuals = individuals.len() as u32; for individual in individuals { self.population.population....
{ PopulationBuilder { population: Population { num_of_individuals: 0, population: Vec::new(), reset_limit: 0, reset_limit_start: 1000, reset_limit_end: 10000, reset_limit_increment: 1000, ...
identifier_body
population_builder.rs
//! This module defines helper functions (builder pattern) to create a valid population. //! //! darwin-rs: evolutionary algorithms with Rust //! //! Written by Willi Kappler, Version 0.4 (2017.06.26) //! //! Repository: https://github.com/willi-kappler/darwin-rs //! //! License: MIT //! //! This library allows you to ...
} /// Configure the increment for the reset_limit. If the reset_limit is reached, its value /// is incrementet by the amount of reset_limit_increment. pub fn reset_limit_increment(mut self, reset_limit_increment: u32) -> PopulationBuilder<T> { self.population.reset_limit_increment = reset_limit...
/// If reset_limit_end == 0 then the reset limit feature will be disabled. pub fn reset_limit_end(mut self, reset_limit_end: u32) -> PopulationBuilder<T> { self.population.reset_limit_end = reset_limit_end; self
random_line_split
population_builder.rs
//! This module defines helper functions (builder pattern) to create a valid population. //! //! darwin-rs: evolutionary algorithms with Rust //! //! Written by Willi Kappler, Version 0.4 (2017.06.26) //! //! Repository: https://github.com/willi-kappler/darwin-rs //! //! License: MIT //! //! This library allows you to ...
(mut self) -> PopulationBuilder<T> { let mut mutation_rate = 1; for wrapper in &mut self.population.population { wrapper.num_of_mutations = mutation_rate; mutation_rate += 1; } self } /// Configures the mutation rates (number of mutation runs) for all t...
increasing_mutation_rate
identifier_name
internal_unstable.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#[stable(feature = "stable", since = "1.0.0")] pub struct Foo { #[unstable(feature = "struct_field", issue = "0")] pub x: u8 } impl Foo { #[unstable(feature = "method", issue = "0")] pub fn method(&self) {} } #[stable(feature = "stable", since = "1.0.0")] pub struct Bar { #[unstable(feature = "...
{}
identifier_body
internal_unstable.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
}
random_line_split
internal_unstable.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self) {} } #[stable(feature = "stable", since = "1.0.0")] pub struct Bar { #[unstable(feature = "struct2_field", issue = "0")] pub x: u8 } #[allow_internal_unstable] #[macro_export] macro_rules! call_unstable_allow { () => { $crate::unstable() } } #[allow_internal_unstable] #[macro_export] macro_rules!...
method
identifier_name
binops.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { assert_eq!((), ()); assert!((!(()!= ()))); assert!((!(() < ()))); assert!((() <= ())); assert!((!(() > ()))); assert!((() >= ())); } fn test_bool() { assert!((!(true < false))); assert!((!(true <= false))); assert!((true > false)); assert!((true >= false)); assert!((fa...
test_nil
identifier_name
binops.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Binop corner cases fn test_nil() { assert_eq!((), ()); assert!((!(()!= ())))...
// // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
random_line_split
euclid.rs
struct UnknownUnit; struct LayoutUnit; #[repr(C)] struct TypedLength<T, Unit>(T, PhantomData<Unit>); #[repr(C)] struct TypedSideOffsets2D<T, U> { top: T, right: T, bottom: T, left: T, _phantom: PhantomData<U>, } #[repr(C)] struct TypedSize2D<T, U> { width: T, height: T, _phantom: Phan...
transform_b: TypedTransform2D<f32, LayoutUnit, UnknownUnit> ) { }
random_line_split
euclid.rs
struct UnknownUnit; struct LayoutUnit; #[repr(C)] struct TypedLength<T, Unit>(T, PhantomData<Unit>); #[repr(C)] struct
<T, U> { top: T, right: T, bottom: T, left: T, _phantom: PhantomData<U>, } #[repr(C)] struct TypedSize2D<T, U> { width: T, height: T, _phantom: PhantomData<U>, } #[repr(C)] struct TypedPoint2D<T, U> { x: T, y: T, _phantom: PhantomData<U>, } #[repr(C)] struct TypedRect<T, U...
TypedSideOffsets2D
identifier_name
variable-scope.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn zzz() {()}
{ let x = false; let y = true; zzz(); { let x = 10; zzz(); } let y = 11; zzz(); }
identifier_body
variable-scope.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() {()}
zzz
identifier_name
variable-scope.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.
// // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test /...
random_line_split
builder.rs
// Copyright (c) 2015 Takeru Ohta <phjgt308@gmail.com> // // This software is released under the MIT License, // see the LICENSE file at the top-level directory. use std::mem; use std::collections::HashMap; use std::rc::Rc; use std::error::Error; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Error as F...
pub fn new() -> Self { Builder { memo: Memo::new(), root: Node::new(EOS), } } pub fn insert(&mut self, word: Word) -> InsertResult { let mut root = mem::replace(&mut self.root, Node::new(EOS)); try!(self.insert_word(&mut root, word)); self.roo...
random_line_split
builder.rs
// Copyright (c) 2015 Takeru Ohta <phjgt308@gmail.com> // // This software is released under the MIT License, // see the LICENSE file at the top-level directory. use std::mem; use std::collections::HashMap; use std::rc::Rc; use std::error::Error; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Error as F...
(&mut self, parent: &mut Node, ch: Option<Char>, mut word: Word) -> InsertResult { match ch { None => { parent.is_terminal = true; Ok(()) } Some(ch) => { ...
add_new_child
identifier_name
builder.rs
// Copyright (c) 2015 Takeru Ohta <phjgt308@gmail.com> // // This software is released under the MIT License, // see the LICENSE file at the top-level directory. use std::mem; use std::collections::HashMap; use std::rc::Rc; use std::error::Error; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Error as F...
fn add_new_child(&mut self, parent: &mut Node, ch: Option<Char>, mut word: Word) -> InsertResult { match ch { None => { parent.is_terminal = true; Ok(()) } ...
{ match word.next() { Some(ch) if parent.child.as_ref().map_or(false, |c| c.ch == ch) => { let child = parent.child.as_mut().unwrap(); self.insert_word(Rc::get_mut(child).unwrap(), word) } next_ch => self.add_new_child(parent, next_ch, word), ...
identifier_body
error.rs
use std::collections::HashSet; use std::io; use serde::{Deserializer, Deserialize}; use reqwest; #[derive(Fail, Debug)]
Reqwest(#[cause] reqwest::Error), #[fail(display = "{}", _0)] Io(#[cause] io::Error), } impl From<reqwest::Error> for Error { fn from(err: reqwest::Error) -> Error { Error::Reqwest(err) } } impl From<io::Error> for Error { fn from(err: io::Error) -> Error { Error::Io(err) }...
pub enum Error { #[fail(display = "{:?}", _0)] Codes(HashSet<Code>), #[fail(display = "{}", _0)]
random_line_split
error.rs
use std::collections::HashSet; use std::io; use serde::{Deserializer, Deserialize}; use reqwest; #[derive(Fail, Debug)] pub enum Error { #[fail(display = "{:?}", _0)] Codes(HashSet<Code>), #[fail(display = "{}", _0)] Reqwest(#[cause] reqwest::Error), #[fail(display = "{}", _0)] Io(#[cause] io::...
(err: reqwest::Error) -> Error { Error::Reqwest(err) } } impl From<io::Error> for Error { fn from(err: io::Error) -> Error { Error::Io(err) } } #[derive(PartialEq, Eq, Hash, Debug)] pub enum Code { MissingSecret, InvalidSecret, MissingResponse, InvalidResponse, BadReque...
from
identifier_name
cnf_system.rs
use std::collections::{BTreeSet, HashSet}; use std::collections::btree_set::Iter; #[allow(dead_code)] #[derive(PartialEq, Eq, Hash, Clone, Debug)] pub enum ClauseType { Tautology, // Always true -- all interpretations are models Satisfiable, // Sometimes true -- has some models Unsatisfiable, /...
assert_eq!(clause, clause2); } /// A conjunction (∧) of clauses #[derive(Eq, PartialEq, Clone, Debug)] pub struct CNFSystem { pub clauses: HashSet<CNFClause>, } impl CNFSystem { pub fn new(initial_clauses: Option<HashSet<CNFClause>>) -> CNFSystem { match initial_clauses { Some(c) => ...
assert_eq!(clause, clause2); assert!(clause.is_tautology()); // Assert that adding the same element means they're still equal (it's a set) clause2.add(2);
random_line_split
cnf_system.rs
use std::collections::{BTreeSet, HashSet}; use std::collections::btree_set::Iter; #[allow(dead_code)] #[derive(PartialEq, Eq, Hash, Clone, Debug)] pub enum ClauseType { Tautology, // Always true -- all interpretations are models Satisfiable, // Sometimes true -- has some models Unsatisfiable, /...
// Removes a clause from the system. Returns false if the value wasn't already in the system pub fn remove_clause(&mut self, clause: &CNFClause) -> bool { self.clauses.remove(clause) } /// Return the amount of clauses in the system pub fn len(&self) -> usize { self.clauses.len() } }...
self.clauses.insert(clause) } /
identifier_body
cnf_system.rs
use std::collections::{BTreeSet, HashSet}; use std::collections::btree_set::Iter; #[allow(dead_code)] #[derive(PartialEq, Eq, Hash, Clone, Debug)] pub enum ClauseType { Tautology, // Always true -- all interpretations are models Satisfiable, // Sometimes true -- has some models Unsatisfiable, /...
t self, literal: &isize) -> bool { self.literals.remove(&literal) } /// Returns an iterator over the literals pub fn iter(&self) -> Iter<isize> { self.literals.iter() } /// Returns true if this clause contains the literal pub fn contains(&self, literal: isize) -> bool { ...
ve(&mu
identifier_name
parse-complex-macro-invoc-op.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() {}
main
identifier_name
parse-complex-macro-invoc-op.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{}
identifier_body
parse-complex-macro-invoc-op.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// pretty-expanded FIXME #23616 #![feature(macro_rules)] macro_rules! id { ($e: expr) => { $e } } fn foo() { id!(1) + 1; id![1] - 1; id!(1) * 1; id![1] / 1; id!(1) % 1; id!(1) & 1; id![1] | 1; id!(1) ^ 1; let mut x = 1; id![x] = 2; id!(x) += 1; id!(1f64).clone(...
// Test parsing binary operators after macro invocations.
random_line_split
cton-util.rs
extern crate cretonne; extern crate cton_reader; extern crate cton_wasm; extern crate cton_filetests; extern crate docopt; #[macro_use] extern crate serde_derive; extern crate filecheck; extern crate tempdir; extern crate term; use cretonne::{VERSION, timing}; use docopt::Docopt; use std::io::{self, Write}; use std::p...
() { if let Err(mut msg) = cton_util() { if!msg.ends_with('\n') { msg.push('\n'); } io::stdout().flush().expect("flushing stdout"); io::stderr().write_all(msg.as_bytes()).unwrap(); process::exit(1); } }
main
identifier_name
cton-util.rs
extern crate cretonne; extern crate cton_reader; extern crate cton_wasm; extern crate cton_filetests; extern crate docopt; #[macro_use] extern crate serde_derive; extern crate filecheck; extern crate tempdir; extern crate term; use cretonne::{VERSION, timing}; use docopt::Docopt; use std::io::{self, Write}; use std::p...
} else if args.cmd_print_cfg { print_cfg::run(&args.arg_file) } else if args.cmd_compile { compile::run( args.arg_file, args.flag_print, &args.flag_set, &args.flag_isa, ) } else if args.cmd_wasm { wasm::run( args.arg...
random_line_split
cton-util.rs
extern crate cretonne; extern crate cton_reader; extern crate cton_wasm; extern crate cton_filetests; extern crate docopt; #[macro_use] extern crate serde_derive; extern crate filecheck; extern crate tempdir; extern crate term; use cretonne::{VERSION, timing}; use docopt::Docopt; use std::io::{self, Write}; use std::p...
else if args.cmd_filecheck { rsfilecheck::run(&args.arg_file, args.flag_verbose) } else if args.cmd_print_cfg { print_cfg::run(&args.arg_file) } else if args.cmd_compile { compile::run( args.arg_file, args.flag_print, &args.flag_set, &args...
{ cat::run(&args.arg_file) }
conditional_block
mod.rs
// Serkr - An automated theorem prover. Copyright (C) 2015-2016 Mikko Aarnos. // // Serkr is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later ver...
/// Autogenerated code, don't care about any warnings. #[allow(missing_docs)] #[allow(dead_code)] #[cfg_attr(rustfmt, rustfmt_skip)] #[cfg_attr(feature="clippy", allow(clippy))] #[cfg_attr(feature="clippy", allow(clippy_pedantic))] mod parser_grammar; /// Contains a function for parsing a formula in the TPTP format t...
random_line_split
run.rs
use std::process::{Command, Child}; use env::EnvList; use super::Result; use error::BenvError;
let mut command = Command::new(&program); command.args(&args); for env in env_list { command.env(env.name, env.value); } let child = try!(command.spawn()); Ok(child) } fn split_program_and_args(program_with_args: &str) -> Result<(String, Vec<&str>)> { // Life would have been good.....
pub fn run(program_with_args: &str, env_list: EnvList) -> Result<Child> { let (program, args) = try!(split_program_and_args(program_with_args));
random_line_split
run.rs
use std::process::{Command, Child}; use env::EnvList; use super::Result; use error::BenvError; pub fn run(program_with_args: &str, env_list: EnvList) -> Result<Child> { let (program, args) = try!(split_program_and_args(program_with_args)); let mut command = Command::new(&program); command.args(&args); ...
let program = vec.remove(0).to_string(); Ok((program, vec)) } // #[cfg(test)] // mod test { // use super::*; // use env::{Env, EnvList}; // #[test] // fn test_simple_command() { // // TODO // // // // With latest nightly, it seems impossible to write a proper test case...
{ return Err(BenvError::MissingProgram); }
conditional_block
run.rs
use std::process::{Command, Child}; use env::EnvList; use super::Result; use error::BenvError; pub fn
(program_with_args: &str, env_list: EnvList) -> Result<Child> { let (program, args) = try!(split_program_and_args(program_with_args)); let mut command = Command::new(&program); command.args(&args); for env in env_list { command.env(env.name, env.value); } let child = try!(command.spawn()...
run
identifier_name