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 |
|---|---|---|---|---|
region.rs | (&self, sub: FreeRegion, sup: FreeRegion) -> bool {
can_reach(&*self.free_region_map.borrow(), sub, sup)
}
/// Determines whether one region is a subregion of another. This is intended to run *after
/// inference* and sadly the logic is somewhat duplicated with the code in infer.rs.
pub fn is_... | { } | conditional_block | |
region.rs | _id());
self.var_map.borrow_mut().insert(var, lifetime);
}
pub fn record_rvalue_scope(&self, var: ast::NodeId, lifetime: CodeExtent) {
debug!("record_rvalue_scope(sub={}, sup={})", var, lifetime);
assert!(var!= lifetime.node_id());
self.rvalue_scopes.borrow_mut().insert(var, lif... |
/// Returns true if `subscope` is equal to or is lexically nested inside `superscope` and false
/// otherwise.
pub fn is_subscope_of(&self,
subscope: CodeExtent,
superscope: CodeExtent)
-> bool {
let mut s = subscope;
... | {
self.is_subscope_of(scope1, scope2) ||
self.is_subscope_of(scope2, scope1)
} | identifier_body |
region.rs | node_id());
self.var_map.borrow_mut().insert(var, lifetime);
}
pub fn record_rvalue_scope(&self, var: ast::NodeId, lifetime: CodeExtent) {
debug!("record_rvalue_scope(sub={}, sup={})", var, lifetime);
assert!(var!= lifetime.node_id());
self.rvalue_scopes.borrow_mut().insert(var,... |
pub fn scopes_intersect(&self, scope1: CodeExtent, scope2: CodeExtent)
-> bool {
self.is_subscope_of(scope1, scope2) ||
self.is_subscope_of(scope2, scope1)
}
/// Returns true if `subscope` is equal to or is lexically nested inside `superscope` and false
/// ... | let scope = ty::ReScope(self.var_scope(id));
debug!("var_region({}) = {}", id, scope);
scope
} | random_line_split |
main.rs |
extern crate clap;
// Time Start: Mon, 02 Dec 2019 12:59:41 -0500
// Time Finish 1: Mon, 02 Dec 2019 14:46:54 -0500 (1 hour, 47 minutes, 13 seconds)
// Time Finish 2: Mon, 02 Dec 2019 14:53:56 -0500 (7 minutes, 2 seconds)
// Time Total: 1 hour, 54 minutes, 15 seconds
use std::convert::TryFrom;
use std::fmt;
use std:... | (&mut self, a: usize, b: usize, c: usize) {
self.program[c] = self.program[a] + self.program[b];
}
fn mul(&mut self, a: usize, b: usize, c: usize) {
self.program[c] = self.program[a] * self.program[b];
}
fn get(&self, i: usize) -> i32 { self.program[i] }
fn peek(&self, i: usize) ->... | add | identifier_name |
main.rs | extern crate clap;
// Time Start: Mon, 02 Dec 2019 12:59:41 -0500
// Time Finish 1: Mon, 02 Dec 2019 14:46:54 -0500 (1 hour, 47 minutes, 13 seconds)
// Time Finish 2: Mon, 02 Dec 2019 14:53:56 -0500 (7 minutes, 2 seconds)
// Time Total: 1 hour, 54 minutes, 15 seconds
use std::convert::TryFrom;
use std::fmt;
use std::... | self.program[c] = self.program[a] * self.program[b];
}
fn get(&self, i: usize) -> i32 { self.program[i] }
fn peek(&self, i: usize) -> i32 { self.get(self.pos + i) }
fn geta(&self, i: usize) -> usize {
usize::try_from(
self.program[i]
).unwrap_or_else(|err| panic!("Ex... | self.program[c] = self.program[a] + self.program[b];
}
fn mul(&mut self, a: usize, b: usize, c: usize) { | random_line_split |
error.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity 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 version.... | (&self, f: &mut fmt::Formatter) -> fmt::Result {
let msg = match *self {
Error::InvalidSecret => "Invalid secret".into(),
Error::InvalidPublic => "Invalid public".into(),
Error::InvalidAddress => "Invalid address".into(),
Error::InvalidSignature => "Invalid EC signature".into(),
Error::InvalidMessage =... | fmt | identifier_name |
error.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity 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 version.... |
impl From<::secp256k1::Error> for Error {
fn from(e: ::secp256k1::Error) -> Error {
match e {
::secp256k1::Error::InvalidMessage => Error::InvalidMessage,
::secp256k1::Error::InvalidPublicKey => Error::InvalidPublic,
::secp256k1::Error::InvalidSecretKey => Error::InvalidSecret,
_ => Error::InvalidSignat... | random_line_split | |
webdriver_msg.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use constellation_msg::PipelineId;
use euclid::rect::Rect;
use ipc_channel::ipc::IpcSender;
use rustc_serialize::j... | #[derive(Deserialize, Serialize)]
pub enum WebDriverJSError {
Timeout,
UnknownType
}
pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>;
#[derive(Deserialize, Serialize)]
pub enum WebDriverFrameId {
Short(u16),
Element(String),
Parent
}
impl ToJson for WebDriverJSValue {
... | random_line_split | |
webdriver_msg.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use constellation_msg::PipelineId;
use euclid::rect::Rect;
use ipc_channel::ipc::IpcSender;
use rustc_serialize::j... | {
Timeout,
UnknownType
}
pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>;
#[derive(Deserialize, Serialize)]
pub enum WebDriverFrameId {
Short(u16),
Element(String),
Parent
}
impl ToJson for WebDriverJSValue {
fn to_json(&self) -> Json {
match *self {
... | WebDriverJSError | identifier_name |
minwinbase.rs | // Copyright © 2016-2017 winapi-rs developers
// 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.
// All files in the project carrying such notice may not be copied,... | lpBaseOfImage: LPVOID,
dwDebugInfoFileOffset: DWORD,
nDebugInfoSize: DWORD,
lpThreadLocalBase: LPVOID,
lpStartAddress: LPTHREAD_START_ROUTINE,
lpImageName: LPVOID,
fUnicode: WORD,
}}
pub type LPCREATE_PROCESS_DEBUG_INFO = *mut CREATE_PROCESS_DEBUG_INFO;
STRUCT!{struct EXIT_THREAD_DEBUG_INFO ... | hProcess: HANDLE,
hThread: HANDLE, | random_line_split |
compositionevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{
self, CompositionEventMethods,
};
use... |
}
impl CompositionEventMethods for CompositionEvent {
// https://w3c.github.io/uievents/#dom-compositionevent-data
fn Data(&self) -> DOMString {
self.data.clone()
}
// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.uievent.IsTrusted()
}
}
| {
&*self.data
} | identifier_body |
compositionevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{
self, CompositionEventMethods,
};
use... | }
pub fn data(&self) -> &str {
&*self.data
}
}
impl CompositionEventMethods for CompositionEvent {
// https://w3c.github.io/uievents/#dom-compositionevent-data
fn Data(&self) -> DOMString {
self.data.clone()
}
// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTr... | Ok(event) | random_line_split |
compositionevent.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{
self, CompositionEventMethods,
};
use... | (&self) -> &str {
&*self.data
}
}
impl CompositionEventMethods for CompositionEvent {
// https://w3c.github.io/uievents/#dom-compositionevent-data
fn Data(&self) -> DOMString {
self.data.clone()
}
// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {... | data | identifier_name |
blob.rs | use std::marker;
use std::slice;
use {raw, Oid, Object};
use util::Binding;
/// A structure to represent a git [blob][1]
///
/// [1]: http://git-scm.com/book/en/Git-Internals-Git-Objects
pub struct Blob<'repo> {
raw: *mut raw::git_blob,
_marker: marker::PhantomData<Object<'repo>>,
}
impl<'repo> Blob<'repo> {... |
/// Determine if the blob content is most certainly binary or not.
pub fn is_binary(&self) -> bool {
unsafe { raw::git_blob_is_binary(&*self.raw) == 1 }
}
/// Get the content of this blob.
pub fn content(&self) -> &[u8] {
unsafe {
let data = raw::git_blob_rawcontent(&*... | {
unsafe { Binding::from_raw(raw::git_blob_id(&*self.raw)) }
} | identifier_body |
blob.rs | use std::marker;
use std::slice;
use {raw, Oid, Object};
use util::Binding;
/// A structure to represent a git [blob][1]
///
/// [1]: http://git-scm.com/book/en/Git-Internals-Git-Objects
pub struct Blob<'repo> {
raw: *mut raw::git_blob,
_marker: marker::PhantomData<Object<'repo>>,
}
impl<'repo> Blob<'repo> {... | let td = TempDir::new("test").unwrap();
let path = td.path().join("foo");
File::create(&path).unwrap().write_all(&[7, 8, 9]).unwrap();
let repo = Repository::init(td.path()).unwrap();
let id = repo.blob_path(&path).unwrap();
let blob = repo.find_blob(id).unwrap();
... | random_line_split | |
blob.rs | use std::marker;
use std::slice;
use {raw, Oid, Object};
use util::Binding;
/// A structure to represent a git [blob][1]
///
/// [1]: http://git-scm.com/book/en/Git-Internals-Git-Objects
pub struct Blob<'repo> {
raw: *mut raw::git_blob,
_marker: marker::PhantomData<Object<'repo>>,
}
impl<'repo> Blob<'repo> {... | (raw: *mut raw::git_blob) -> Blob<'repo> {
Blob {
raw: raw,
_marker: marker::PhantomData,
}
}
fn raw(&self) -> *mut raw::git_blob { self.raw }
}
impl<'repo> Drop for Blob<'repo> {
fn drop(&mut self) {
unsafe { raw::git_blob_free(self.raw) }
}
}
#[cfg(te... | from_raw | identifier_name |
main.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![cfg(test)]
#[macro_use]
extern crate lazy_static;
mod cookie;
mod cookie_http_state;
mod data_loader;
mod fet... | mod mime_classifier;
mod resource_thread;
mod subresource_integrity;
use devtools_traits::DevtoolsControlMsg;
use embedder_traits::resources::{self, Resource};
use embedder_traits::{EmbedderProxy, EventLoopWaker};
use futures::{Future, Stream};
use hyper::server::conn::Http;
use hyper::server::Server as HyperServer;
u... | mod filemanager_thread;
mod hsts;
mod http_loader; | random_line_split |
main.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![cfg(test)]
#[macro_use]
extern crate lazy_static;
mod cookie;
mod cookie_http_state;
mod data_loader;
mod fet... | .map_err(|_| ())
.and_then(move |ssl| {
Http::new()
.serve_connection(
ssl,
service_fn_ok(move |req: HyperRequest<Body>| {
let mut response = HyperResponse::new(Vec::<u8>::new().into());
... | {
let handler = Arc::new(handler);
let listener = StdTcpListener::bind("[::0]:0").unwrap();
let listener = TcpListener::from_std(listener, &HANDLE.lock().unwrap().reactor()).unwrap();
let url_string = format!("http://localhost:{}", listener.local_addr().unwrap().port());
let url = ServoUrl::parse(&u... | identifier_body |
main.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![cfg(test)]
#[macro_use]
extern crate lazy_static;
mod cookie;
mod cookie_http_state;
mod data_loader;
mod fet... | {
sender: Sender<Response>,
}
fn create_embedder_proxy() -> EmbedderProxy {
let (sender, _) = channel();
let event_loop_waker = || {
struct DummyEventLoopWaker {}
impl DummyEventLoopWaker {
fn new() -> DummyEventLoopWaker {
DummyEventLoopWaker {}
}
... | FetchResponseCollector | identifier_name |
main4.rs | fn main() {
let value = std::env::args().nth(1);
let convert_and_double = compose(convert, double);
match convert_and_double(value) {
Some(n) => println!("{}", n),
None => println!("No value"),
}
}
fn convert(n: Option<String>) -> Option<f32> |
fn double(n: Option<f32>) -> Option<f32> {
n.map(|n| n * 2.0)
}
fn compose<'f, T1, T2, T3, F1, F2>(a: F1, b: F2) -> Box<Fn(T1) -> T3 + 'f>
where F1:Fn(T1) -> T2 + 'f,
F2:Fn(T2) -> T3 + 'f
{
Box::new(move |input| b(a(input)))
} | {
n.and_then(|n| n.parse().ok())
} | identifier_body |
main4.rs | fn main() {
let value = std::env::args().nth(1);
let convert_and_double = compose(convert, double);
match convert_and_double(value) {
Some(n) => println!("{}", n),
None => println!("No value"), | fn convert(n: Option<String>) -> Option<f32> {
n.and_then(|n| n.parse().ok())
}
fn double(n: Option<f32>) -> Option<f32> {
n.map(|n| n * 2.0)
}
fn compose<'f, T1, T2, T3, F1, F2>(a: F1, b: F2) -> Box<Fn(T1) -> T3 + 'f>
where F1:Fn(T1) -> T2 + 'f,
F2:Fn(T2) -> T3 + 'f
{
Box::new(move |inp... | }
}
| random_line_split |
main4.rs | fn main() {
let value = std::env::args().nth(1);
let convert_and_double = compose(convert, double);
match convert_and_double(value) {
Some(n) => println!("{}", n),
None => println!("No value"),
}
}
fn convert(n: Option<String>) -> Option<f32> {
n.and_then(|n| n.parse().ok())
}
fn... | <'f, T1, T2, T3, F1, F2>(a: F1, b: F2) -> Box<Fn(T1) -> T3 + 'f>
where F1:Fn(T1) -> T2 + 'f,
F2:Fn(T2) -> T3 + 'f
{
Box::new(move |input| b(a(input)))
} | compose | identifier_name |
glass.rs | //! Defines a specular glass material
//!
//! # Scene Usage Example
//! The specular glass material describes a thing glass surface type of material,
//! not a solid block of glass (there is no absorption of light). The glass requires
//! a reflective and emissive color along with a refrective index, eta.
//!
//! ```js... |
if!transmit.is_black() {
bxdfs.push(Box::new(SpecularTransmission::new(transmit, Dielectric::new(1.0, eta)))
as Box<BxDF + Send + Sync>);
}
Glass { bxdfs: bxdfs, eta: eta }
}
}
impl Material for Glass {
fn bsdf<'a, 'b>(&'a self, hit: &Intersection<'a, ... | {
bxdfs.push(Box::new(SpecularReflection::new(reflect,
Box::new(Dielectric::new(1.0, eta)) as Box<Fresnel + Send + Sync>))
as Box<BxDF + Send + Sync>);
} | conditional_block |
glass.rs | //! Defines a specular glass material
//!
//! # Scene Usage Example
//! The specular glass material describes a thing glass surface type of material,
//! not a solid block of glass (there is no absorption of light). The glass requires
//! a reflective and emissive color along with a refrective index, eta.
//!
//! ```js... |
}
impl Material for Glass {
fn bsdf<'a, 'b>(&'a self, hit: &Intersection<'a, 'b>) -> BSDF<'a> {
BSDF::new(&self.bxdfs, self.eta, &hit.dg)
}
}
| {
let mut bxdfs = Vec::new();
if !reflect.is_black() {
bxdfs.push(Box::new(SpecularReflection::new(reflect,
Box::new(Dielectric::new(1.0, eta)) as Box<Fresnel + Send + Sync>))
as Box<BxDF + Send + Sync>);
}
if !transmit.is_bla... | identifier_body |
glass.rs | //! Defines a specular glass material
//!
//! # Scene Usage Example
//! The specular glass material describes a thing glass surface type of material,
//! not a solid block of glass (there is no absorption of light). The glass requires
//! a reflective and emissive color along with a refrective index, eta.
//!
//! ```js... | <'a, 'b>(&'a self, hit: &Intersection<'a, 'b>) -> BSDF<'a> {
BSDF::new(&self.bxdfs, self.eta, &hit.dg)
}
}
| bsdf | identifier_name |
glass.rs | //! Defines a specular glass material
//!
//! # Scene Usage Example
//! The specular glass material describes a thing glass surface type of material,
//! not a solid block of glass (there is no absorption of light). The glass requires
//! a reflective and emissive color along with a refrective index, eta.
//!
//! ```js... | /// The Glass material describes specularly transmissive and reflective glass material
pub struct Glass {
bxdfs: Vec<Box<BxDF + Send + Sync>>,
eta: f32,
}
impl Glass {
/// Create the glass material with the desired color and index of refraction
/// `reflect`: color of reflected light
/// `transmit`... | use bxdf::fresnel::{Dielectric, Fresnel};
use material::Material;
| random_line_split |
error.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! A placeholder encoding that returns encoder/decoder error for every case.
use libtww::std::convert::Into;
use types::*;
/// An encoding that returns encoder/decoder error for every case.
... |
fn raw_feed(&mut self, input: &str, _output: &mut ByteWriter) -> (usize, Option<CodecError>) {
if let Some(ch) = input.chars().next() {
(0,
Some(CodecError {
upto: ch.len_utf8() as isize,
cause: "unrepresentable character".into(),
}))
... | {
ErrorEncoder::new()
} | identifier_body |
error.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! A placeholder encoding that returns encoder/decoder error for every case.
use libtww::std::convert::Into;
use types::*;
/// An encoding that returns encoder/decoder error for every case.
... |
}
fn raw_finish(&mut self, _output: &mut ByteWriter) -> Option<CodecError> {
None
}
}
/// A decoder that always returns error.
#[derive(Clone, Copy)]
pub struct ErrorDecoder;
impl ErrorDecoder {
pub fn new() -> Box<RawDecoder> {
Box::new(ErrorDecoder)
}
}
impl RawDecoder for Err... | {
(0, None)
} | conditional_block |
error.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! A placeholder encoding that returns encoder/decoder error for every case.
use libtww::std::convert::Into;
use types::*;
/// An encoding that returns encoder/decoder error for every case.
... | ErrorEncoder::new()
}
fn raw_decoder(&self) -> Box<RawDecoder> {
ErrorDecoder::new()
}
}
/// An encoder that always returns error.
#[derive(Clone, Copy)]
pub struct ErrorEncoder;
impl ErrorEncoder {
pub fn new() -> Box<RawEncoder> {
Box::new(ErrorEncoder)
}
}
impl RawEncod... | fn raw_encoder(&self) -> Box<RawEncoder> { | random_line_split |
error.rs | // This is a part of rust-encoding.
// Copyright (c) 2013-2015, Kang Seonghoon.
// See README.md and LICENSE.txt for details.
//! A placeholder encoding that returns encoder/decoder error for every case.
use libtww::std::convert::Into;
use types::*;
/// An encoding that returns encoder/decoder error for every case.
... | (&mut self, _output: &mut ByteWriter) -> Option<CodecError> {
None
}
}
/// A decoder that always returns error.
#[derive(Clone, Copy)]
pub struct ErrorDecoder;
impl ErrorDecoder {
pub fn new() -> Box<RawDecoder> {
Box::new(ErrorDecoder)
}
}
impl RawDecoder for ErrorDecoder {
fn from_s... | raw_finish | identifier_name |
domtokenlist.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::DOMTokenListBinding;
use dom::bindings::codegen::Bindin... |
// https://dom.spec.whatwg.org/#dom-domtokenlist-toggle
fn Toggle(&self, token: DOMString, force: Option<bool>) -> Fallible<bool> {
let element = self.element.root();
let mut atoms = element.r().get_tokenlist_attribute(&self.local_name);
let token = try!(self.check_token_exceptions(&to... | {
let element = self.element.root();
let mut atoms = element.r().get_tokenlist_attribute(&self.local_name);
for token in &tokens {
let token = try!(self.check_token_exceptions(&token));
atoms.iter().position(|atom| *atom == token).map(|index| {
atoms.remov... | identifier_body |
domtokenlist.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::DOMTokenListBinding;
use dom::bindings::codegen::Bindin... | (&self, tokens: Vec<DOMString>) -> ErrorResult {
let element = self.element.root();
let mut atoms = element.r().get_tokenlist_attribute(&self.local_name);
for token in &tokens {
let token = try!(self.check_token_exceptions(&token));
if!atoms.iter().any(|atom| *atom == tok... | Add | identifier_name |
domtokenlist.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::DOMTokenListBinding;
use dom::bindings::codegen::Bindin... | atoms.push(token);
element.r().set_atomic_tokenlist_attribute(&self.local_name, atoms);
Ok(true)
}
}
}
}
// https://dom.spec.whatwg.org/#stringification-behavior
fn Stringifier(&self) -> DOMString {
let ... | Some(false) => Ok(false),
_ => { | random_line_split |
domtokenlist.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::DOMTokenListBinding;
use dom::bindings::codegen::Bindin... |
}
}
}
// https://dom.spec.whatwg.org/#stringification-behavior
fn Stringifier(&self) -> DOMString {
let tokenlist = self.element.root().r().get_tokenlist_attribute(&self.local_name);
str_join(&tokenlist, "\x20")
}
// check-tidy: no specs after this line
fn ... | {
atoms.push(token);
element.r().set_atomic_tokenlist_attribute(&self.local_name, atoms);
Ok(true)
} | conditional_block |
log.rs | /* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARR... | println!("{}:{} <{:?}> -- {}", filename, line, level, message);
return 0;
}
// Convert a &str into a CString by first stripping NUL bytes.
fn to_safe_cstring(val: &str) -> CString {
let mut safe = Vec::with_capacity(val.len());
for c in val.as_bytes() {
if *c!= 0 {
safe.push(*c);
... | {
unsafe {
if let Some(c) = SC {
return (c.SCLogMessage)(
level as i32,
to_safe_cstring(filename).as_ptr(),
line,
to_safe_cstring(function).as_ptr(),
code,
to_safe_cstring(message).as_ptr());
... | identifier_body |
log.rs | /* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARR... |
}
// Fall back if the Suricata C context is not registered which is
// the case when Rust unit tests are running.
//
// We don't log the time right now as I don't think it can be done
// with Rust 1.7.0 without using an external crate. With Rust
// 1.8.0 and newer we can unix UNIX_EPOCH.el... | {
return (c.SCLogMessage)(
level as i32,
to_safe_cstring(filename).as_ptr(),
line,
to_safe_cstring(function).as_ptr(),
code,
to_safe_cstring(message).as_ptr());
} | conditional_block |
log.rs | /* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARR... |
#[macro_export]
macro_rules!SCLogDebug {
($($arg:tt)*) => {
do_log!(Level::Debug, file!(), line!(), function!(), 0, $($arg)*);
}
}
#[no_mangle]
pub extern "C" fn rs_log_set_level(level: i32) {
unsafe {
LEVEL = level;
}
}
pub fn log_set_level(level: Level) {
rs_log_set_level(level ... | ($($arg:tt)*) => {
do_log!(Level::Config, file!(), line!(), function!(), 0, $($arg)*);
}
} | random_line_split |
log.rs | /* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARR... | (level: Level,
filename: &str,
line: libc::c_uint,
function: &str,
code: libc::c_int,
message: &str) -> libc::c_int
{
unsafe {
if let Some(c) = SC {
return (c.SCLogMessage)(
... | sc_log_message | identifier_name |
note.rs | //! Manipulations of MIDI notes.
use std::collections::HashMap;
use std::ops::Add;
use Result;
// The value of a single MIDI note. A wrapper around the raw MIDI note value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Note(pub u8);
impl Note {
/// Try to decode a textual node name. ... | (self, other: i8) -> Note {
Note((self.0 as i8 + other) as u8)
}
}
lazy_static! {
static ref NOTES: HashMap<char, u8> = {
let mut m = HashMap::new();
m.insert('C', 60);
m.insert('D', 62);
m.insert('E', 64);
m.insert('F', 65);
m.insert('G', 67);
m.... | add | identifier_name |
note.rs | //! Manipulations of MIDI notes.
use std::collections::HashMap;
use std::ops::Add;
use Result;
// The value of a single MIDI note. A wrapper around the raw MIDI note value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Note(pub u8);
impl Note {
/// Try to decode a textual node name. ... | good("F", 65);
good("G", 67);
good("A", 69);
good("B", 71);
good("B#", 72);
}
fn good(text: &str, expect: u8) {
match Note::from_str(text) {
Ok(Note(value)) => assert_eq!(expect, value),
Err(_) => panic!("Expected note to parse: {:?}", tex... | good("D♯", 63);
good("E", 64); | random_line_split |
note.rs | //! Manipulations of MIDI notes.
use std::collections::HashMap;
use std::ops::Add;
use Result;
// The value of a single MIDI note. A wrapper around the raw MIDI note value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Note(pub u8);
impl Note {
/// Try to decode a textual node name. ... |
Ok(Note((base.unwrap() as i8 + accidental.unwrap_or(0)) as u8))
}
}
impl Add<i8> for Note {
type Output = Note;
fn add(self, other: i8) -> Note {
Note((self.0 as i8 + other) as u8)
}
}
lazy_static! {
static ref NOTES: HashMap<char, u8> = {
let mut m = HashMap::new();
... | {
return Err(format!("Invalid note {:?}", text).into());
} | conditional_block |
note.rs | //! Manipulations of MIDI notes.
use std::collections::HashMap;
use std::ops::Add;
use Result;
// The value of a single MIDI note. A wrapper around the raw MIDI note value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Note(pub u8);
impl Note {
/// Try to decode a textual node name. ... | Note::from_str(text) {
Ok(_) => panic!("Should not have parsed: {:?}", text),
Err(_) => (),
}
}
}
| identifier_body | |
main.rs | //#[cfg(not(test))]
#![crate_type = "bin"]
#![crate_name = "krakusc"]
#![feature(non_ascii_idents)]
#[macro_use]
extern crate krakus_vm as krakus;
extern crate getopts;
use getopts::Options;
use krakus::*;
use std::env;
use std::mem;
fn print_usage(program: &str, opts: Options) {
let brief = format!("Usage:... | ()
{
use std::io::prelude::*;
use std::fs::File;
let args: Vec<String> = env::args().collect();
let program = args[0].clone();
let mut opts = Options::new();
//opts.optopt("o", "", "set output file name", "NAME");
opts.optflag("h", "help", "print this help menu");
let matches = match o... | main | identifier_name |
main.rs | //#[cfg(not(test))]
#![crate_type = "bin"] | #![crate_name = "krakusc"]
#![feature(non_ascii_idents)]
#[macro_use]
extern crate krakus_vm as krakus;
extern crate getopts;
use getopts::Options;
use krakus::*;
use std::env;
use std::mem;
fn print_usage(program: &str, opts: Options) {
let brief = format!("Usage: {} [options]", program);
print!("{}", ... | random_line_split | |
main.rs | //#[cfg(not(test))]
#![crate_type = "bin"]
#![crate_name = "krakusc"]
#![feature(non_ascii_idents)]
#[macro_use]
extern crate krakus_vm as krakus;
extern crate getopts;
use getopts::Options;
use krakus::*;
use std::env;
use std::mem;
fn print_usage(program: &str, opts: Options) {
let brief = format!("Usage:... | else {
print_usage(&program, opts);
return;
};
let mut f = match File::open(input)
{
Ok(v) => v,
Err(_) => panic!("Guy, that is not a file I can open!"),
};
let mut s = String::new();
f.read_to_string(&mut s).unwrap();
let forward_euler_ff = |args: Vec<u64... | {
matches.free[0].clone()
} | conditional_block |
main.rs | //#[cfg(not(test))]
#![crate_type = "bin"]
#![crate_name = "krakusc"]
#![feature(non_ascii_idents)]
#[macro_use]
extern crate krakus_vm as krakus;
extern crate getopts;
use getopts::Options;
use krakus::*;
use std::env;
use std::mem;
fn print_usage(program: &str, opts: Options) {
let brief = format!("Usage:... | matches.free[0].clone()
} else {
print_usage(&program, opts);
return;
};
let mut f = match File::open(input)
{
Ok(v) => v,
Err(_) => panic!("Guy, that is not a file I can open!"),
};
let mut s = String::new();
f.read_to_string(&mut s).unwrap();
... | {
use std::io::prelude::*;
use std::fs::File;
let args: Vec<String> = env::args().collect();
let program = args[0].clone();
let mut opts = Options::new();
//opts.optopt("o", "", "set output file name", "NAME");
opts.optflag("h", "help", "print this help menu");
let matches = match opts... | identifier_body |
extern-call-indirect.rs | // run-pass
// ignore-wasm32-bare no libc to test ffi with
#![feature(rustc_private)]
extern crate libc;
mod rustrt {
extern crate libc;
#[link(name = "rust_test_helpers", kind = "static")]
extern "C" {
pub fn rust_dbg_call(
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
... | {
let result = fact(10);
println!("result = {}", result);
assert_eq!(result, 3628800);
} | identifier_body | |
extern-call-indirect.rs | // run-pass |
extern crate libc;
mod rustrt {
extern crate libc;
#[link(name = "rust_test_helpers", kind = "static")]
extern "C" {
pub fn rust_dbg_call(
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
data: libc::uintptr_t,
) -> libc::uintptr_t;
}
}
extern "C" fn cb(... | // ignore-wasm32-bare no libc to test ffi with
#![feature(rustc_private)] | random_line_split |
extern-call-indirect.rs | // run-pass
// ignore-wasm32-bare no libc to test ffi with
#![feature(rustc_private)]
extern crate libc;
mod rustrt {
extern crate libc;
#[link(name = "rust_test_helpers", kind = "static")]
extern "C" {
pub fn rust_dbg_call(
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
... | else { fact(data - 1) * data }
}
fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
unsafe {
println!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = fact(10);
println!("result = {}", result);
assert_eq!(result, 3628800);
}
| { data } | conditional_block |
extern-call-indirect.rs | // run-pass
// ignore-wasm32-bare no libc to test ffi with
#![feature(rustc_private)]
extern crate libc;
mod rustrt {
extern crate libc;
#[link(name = "rust_test_helpers", kind = "static")]
extern "C" {
pub fn rust_dbg_call(
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
... | (data: libc::uintptr_t) -> libc::uintptr_t {
if data == 1 { data } else { fact(data - 1) * data }
}
fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
unsafe {
println!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = fact(10);
println!("result = {}", resul... | cb | identifier_name |
syntax.rs | extern crate liquid;
use liquid::LiquidOptions;
use liquid::Renderable;
use liquid::Context;
use liquid::parse;
use std::default::Default;
macro_rules! compare {
($input:expr, $output:expr) => {
let input = $input.replace("…", " ");
let expected = $output.replace("…", " ");
let options: Li... | } | "
topic1-bar\
"
); | random_line_split |
syntax.rs | extern crate liquid;
use liquid::LiquidOptions;
use liquid::Renderable;
use liquid::Context;
use liquid::parse;
use std::default::Default;
macro_rules! compare {
($input:expr, $output:expr) => {
let input = $input.replace("…", " ");
let expected = $output.replace("…", " ");
let options: Li... | ic1
……{%- assign foo = \"bar\" -%}
……-……{{- foo -}}……
",
"
topic1-bar\
"
);
}
| "bar\" -%}
……{% if foo -%}
…………-……{{- foo }}
……{%- endif %}
",
"
topic1
……-bar
"
);
}
#[test]
pub fn double_sided_whitespace_control() {
compare!(
"
top | identifier_body |
syntax.rs | extern crate liquid;
use liquid::LiquidOptions;
use liquid::Renderable;
use liquid::Context;
use liquid::parse;
use std::default::Default;
macro_rules! compare {
($input:expr, $output:expr) => {
let input = $input.replace("…", " ");
let expected = $output.replace("…", " ");
let options: Li... |
compare!(
"
topic1
……{% assign foo = \"bar\" %}
……{% if foo %}
…………-……{{ foo }}
……{% endif %}
",
"
topic1
……
……
…………-……bar
……
"
);
}
#[test]
pub fn simple_whitespace_control() {
compare!(
"
topic1
……{% assign foo = \"bar\" -%}
……{% if foo -%}
…………-……{{- foo }}
……{%- endif %}
",
... | hitespace_control() { | identifier_name |
macros.rs | /// Helper macro to get real values out of Value while retaining
/// proper errors in filters
///
/// Takes 4 args:
///
/// - the filter name,
/// - the variable name: use "value" if you are using it on the variable the filter is ran on
/// - the expected type
/// - the actual variable | /// ```rust,ignore
/// let arr = try_get_value!("first", "value", Vec<Value>, value);
/// let val = try_get_value!("pluralize", "suffix", String, val.clone());
/// ```
#[macro_export]
macro_rules! try_get_value {
($filter_name:expr, $var_name:expr, $ty:ty, $val:expr) => {{
match $crate::from_value::<$ty>($v... | /// | random_line_split |
lint-unused-mut-variables.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 ... | (f: ||) {}
// make sure the lint attribute can be turned off
#[allow(unused_mut)]
fn foo(mut a: int) {
let mut a = 3;
let mut b = ~[2];
}
| callback | identifier_name |
lint-unused-mut-variables.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 nothing(mut foo: int) { foo = 37; }
// leading underscore should avoid the warning, just like the
// unused variable lint.
let mut _allowed = 1;
}
fn callback(f: ||) {}
// make sure the lint attribute can be turned off
#[allow(unused_mut)]
fn foo(mut a: int) {
let mut a = 3;
let mut b = ~[... | }
let x = |mut y: int| y = 32; | random_line_split |
lint-unused-mut-variables.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 ... | //~ ERROR: variable does not need to be mutable
// positive cases
let mut a = 2;
a = 3;
let mut a = ~[];
a.push(3);
let mut a = ~[];
callback(|| {
a.push(3);
});
let (mut a, b) = (1, 2);
a = 34;
match 30 {
mut x => {
x = 21;
}
}
... | {} | identifier_body |
str.rs | : &mut H) {
self.0.hash(state);
}
}
impl FromStr for ByteString {
type Err = ();
fn from_str(s: &str) -> Result<ByteString, ()> {
Ok(ByteString::new(s.to_owned().into_bytes()))
}
}
impl ops::Deref for ByteString {
type Target = [u8];
fn deref(&self) -> &[u8] {
&self.0
... | // Step 3
let date = iterator.next().ok_or(())?;
let date_tuple = parse_date_component(date)?;
// Step 5
let time = iterator.next().ok_or(())?;
let time_tuple = parse_time_component(time)?;
// Step 6
if iterator.next().is_some() {
return Err((... | value.split(' ')
};
| conditional_block |
str.rs | &mut H) {
self.0.hash(state);
}
}
impl FromStr for ByteString {
type Err = ();
fn from_str(s: &str) -> Result<ByteString, ()> {
Ok(ByteString::new(s.to_owned().into_bytes()))
}
}
impl ops::Deref for ByteString {
type Target = [u8];
fn deref(&self) -> &[u8] {
&self.0
... | lf, other: &&'a str) -> bool {
&**self == *other
}
}
impl From<String> for USVString {
fn from(contents: String) -> USVString {
USVString(contents)
}
}
/// Returns whether `s` is a `token`, as defined by
/// [RFC 2616](http://tools.ietf.org/html/rfc2616#page-17).
pub fn is_token(s: &[u8]) ... | se | identifier_name |
str.rs | state: &mut H) {
self.0.hash(state);
}
}
impl FromStr for ByteString {
type Err = ();
fn from_str(s: &str) -> Result<ByteString, ()> {
Ok(ByteString::new(s.to_owned().into_bytes()))
}
}
impl ops::Deref for ByteString {
type Target = [u8];
fn deref(&self) -> &[u8] {
&se... | #[inline]
fn deref(&self) -> &str {
&self.0
}
}
impl DerefMut for DOMString {
#[inline]
fn deref_mut(&mut self) -> &mut str {
&mut self.0
}
}
impl AsRef<str> for DOMString {
fn as_ref(&self) -> &str {
&self.0
}
}
impl fmt::Display for DOMString {
#[inline]
... | random_line_split | |
16843_H2.rs | Per(s)PSA @ damp 02% PSA @ damp 05% PSA @ damp 07% PSA @ damp 10% PSA @ damp 20% PSA @ damp 30% (m/s/s)
0.000 1.2913000E-001 1.2913000E-001 1.2913000E-001 1.2913000E-001 1.2913000E-001 1.2913000E-001
0.010 1.2913360E-001 1.2913613E-001 1.2913640E-001 1.2913629E-001 1.2913558E-001 1.2913461E-001
0.020 1.2915231E-001 ... | 0.850 5.5704033E-001 3.8282755E-001 3.2834914E-001 2.7688667E-001 2.2146527E-001 1.8825164E-001
0.900 6.7406952E-001 4.6881771E-001 3.9615718E-001 3.3011246E-001 2.3729219E-001 1.9391888E-001
0.950 6.9230747E-001 4.9054167E-001 4.1994503E-001 3.5270956E-001 2.4773170E-001 1.9823655E-001
1.000 6.5518957E-001 4.571457... | 0.650 4.7647312E-001 3.5121968E-001 3.0050832E-001 2.5218114E-001 1.9111256E-001 1.6741602E-001
0.700 5.9655309E-001 3.8487825E-001 3.2717097E-001 2.7232391E-001 1.8298441E-001 1.6780384E-001
0.750 4.4711676E-001 3.2956755E-001 2.9612157E-001 2.5945029E-001 1.9378230E-001 1.7481418E-001
0.800 3.8252521E-001 2.867860... | random_line_split |
counterfeit.rs | extern crate glktest;
extern crate glulx;
extern crate iff;
use std::time::Instant;
use glktest::TestOutput::Match;
mod common;
#[test]
#[ignore]
fn | () {
let start = Instant::now();
assert!(common::run_blorb("CounterfeitMonkey-6.gblorb", vec![
(Match("\n\n\nCan you hear me? >> "), "yes"),
(Match("\nGood, you\'re conscious. We\'re conscious. I\'ve heard urban legends about synthesis going wrong, one half person getting lost.\n... | counterfeit | identifier_name |
counterfeit.rs | extern crate glktest;
extern crate glulx;
extern crate iff;
use std::time::Instant;
use glktest::TestOutput::Match;
mod common;
#[test]
#[ignore]
fn counterfeit() | {
let start = Instant::now();
assert!(common::run_blorb("CounterfeitMonkey-6.gblorb", vec![
(Match("\n\n\nCan you hear me? >> "), "yes"),
(Match("\nGood, you\'re conscious. We\'re conscious. I\'ve heard urban legends about synthesis going wrong, one half person getting lost.\n\nD... | identifier_body | |
counterfeit.rs | extern crate glktest;
extern crate glulx;
extern crate iff;
use std::time::Instant;
use glktest::TestOutput::Match;
mod common; | let start = Instant::now();
assert!(common::run_blorb("CounterfeitMonkey-6.gblorb", vec![
(Match("\n\n\nCan you hear me? >> "), "yes"),
(Match("\nGood, you\'re conscious. We\'re conscious. I\'ve heard urban legends about synthesis going wrong, one half person getting lost.\n\nDo ... |
#[test]
#[ignore]
fn counterfeit() { | random_line_split |
007.rs | #![feature(associated_types, slicing_syntax)]
extern crate test;
extern crate time;
use std::collections::HashMap;
use std::io::stdio;
use std::os;
struct Primes {
map: HashMap<u32, u32>,
n: u32,
}
impl Iterator for Primes {
type Item = u32;
fn next(&mut self) -> Option<u32> {
loop {
... | ,
}
for line in stdio::stdin().lock().lines() {
let iters: u64 = line.unwrap()[].trim().parse().unwrap();
let start = time::precise_time_ns();
for _ in range(0, iters) {
test::black_box(solution());
}
let end = time::precise_time_ns();
println!("{}"... | {} | conditional_block |
007.rs | #![feature(associated_types, slicing_syntax)]
extern crate test;
extern crate time;
use std::collections::HashMap;
use std::io::stdio;
use std::os;
struct Primes {
map: HashMap<u32, u32>,
n: u32,
}
impl Iterator for Primes {
type Item = u32;
fn next(&mut self) -> Option<u32> {
loop {
... | let end = time::precise_time_ns();
println!("{}", end - start);
}
} | } | random_line_split |
007.rs | #![feature(associated_types, slicing_syntax)]
extern crate test;
extern crate time;
use std::collections::HashMap;
use std::io::stdio;
use std::os;
struct Primes {
map: HashMap<u32, u32>,
n: u32,
}
impl Iterator for Primes {
type Item = u32;
fn next(&mut self) -> Option<u32> {
loop {
... |
fn solution() -> u32 {
let target = 10_000;
primes(target).nth(target).unwrap()
}
fn main() {
match os::args()[] {
[_, ref flag] if flag[] == "-a" => return println!("{}", solution()),
_ => {},
}
for line in stdio::stdin().lock().lines() {
let iters: u64 = line.unwrap()[... | {
Primes {
map: HashMap::with_capacity(capacity),
n: 1,
}
} | identifier_body |
007.rs | #![feature(associated_types, slicing_syntax)]
extern crate test;
extern crate time;
use std::collections::HashMap;
use std::io::stdio;
use std::os;
struct Primes {
map: HashMap<u32, u32>,
n: u32,
}
impl Iterator for Primes {
type Item = u32;
fn next(&mut self) -> Option<u32> {
loop {
... | (capacity: uint) -> Primes {
Primes {
map: HashMap::with_capacity(capacity),
n: 1,
}
}
fn solution() -> u32 {
let target = 10_000;
primes(target).nth(target).unwrap()
}
fn main() {
match os::args()[] {
[_, ref flag] if flag[] == "-a" => return println!("{}", solution()),
... | primes | identifier_name |
trace_macros.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 ... | (cx: @ExtCtxt,
sp: span,
tt: &[ast::token_tree])
-> base::MacResult {
let sess = cx.parse_sess();
let cfg = cx.cfg();
let tt_rdr = new_tt_reader(
copy cx.parse_sess().span_diagnostic,
None,
tt.to_owned()
... | expand_trace_macros | identifier_name |
trace_macros.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 ... | } | random_line_split | |
trace_macros.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 ... | else if rust_parser.is_keyword(keywords::False) {
cx.set_trace_macros(false);
} else {
cx.span_fatal(sp, "trace_macros! only accepts `true` or `false`")
}
rust_parser.bump();
let rust_parser = Parser(sess, cfg, rdr.dup());
let result = rust_parser.parse_expr();
base::MRExpr(re... | {
cx.set_trace_macros(true);
} | conditional_block |
trace_macros.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 ... | cx.span_fatal(sp, "trace_macros! only accepts `true` or `false`")
}
rust_parser.bump();
let rust_parser = Parser(sess, cfg, rdr.dup());
let result = rust_parser.parse_expr();
base::MRExpr(result)
}
| {
let sess = cx.parse_sess();
let cfg = cx.cfg();
let tt_rdr = new_tt_reader(
copy cx.parse_sess().span_diagnostic,
None,
tt.to_owned()
);
let rdr = tt_rdr as @reader;
let rust_parser = Parser(
sess,
copy cfg,
rdr.dup()
);
if rust_parser.i... | identifier_body |
world_scene.rs | use caches::art_cache::ArtCache;
use caches::texmap_cache::TexMapCache;
use cgmath::Point2;
use ggez::event::{KeyCode, KeyMods};
use ggez::graphics::{self};
use ggez::{Context, GameResult};
use map::render::draw_block;
use map::{map_id_to_facet, Facet, MAP_DETAILS};
use scene::{BoxedScene, Scene, SceneChangeEvent, Scen... |
}
| {
if self.exiting {
Ok(Some(SceneChangeEvent::PopScene))
} else {
Ok(None)
}
} | identifier_body |
world_scene.rs | use caches::art_cache::ArtCache;
use caches::texmap_cache::TexMapCache;
use cgmath::Point2;
use ggez::event::{KeyCode, KeyMods};
use ggez::graphics::{self};
use ggez::{Context, GameResult};
use map::render::draw_block;
use map::{map_id_to_facet, Facet, MAP_DETAILS};
use scene::{BoxedScene, Scene, SceneChangeEvent, Scen... | (
&mut self,
_ctx: &mut Context,
_engine_data: &mut (),
) -> GameResult<Option<SceneChangeEvent<SceneName>>> {
if self.exiting {
Ok(Some(SceneChangeEvent::PopScene))
} else {
Ok(None)
}
}
}
| update | identifier_name |
world_scene.rs | use caches::art_cache::ArtCache;
use caches::texmap_cache::TexMapCache;
use cgmath::Point2;
use ggez::event::{KeyCode, KeyMods};
use ggez::graphics::{self};
use ggez::{Context, GameResult};
use map::render::draw_block;
use map::{map_id_to_facet, Facet, MAP_DETAILS};
use scene::{BoxedScene, Scene, SceneChangeEvent, Scen... | if self.exiting {
Ok(Some(SceneChangeEvent::PopScene))
} else {
Ok(None)
}
}
} | ) -> GameResult<Option<SceneChangeEvent<SceneName>>> { | random_line_split |
world_scene.rs | use caches::art_cache::ArtCache;
use caches::texmap_cache::TexMapCache;
use cgmath::Point2;
use ggez::event::{KeyCode, KeyMods};
use ggez::graphics::{self};
use ggez::{Context, GameResult};
use map::render::draw_block;
use map::{map_id_to_facet, Facet, MAP_DETAILS};
use scene::{BoxedScene, Scene, SceneChangeEvent, Scen... |
KeyCode::Down => {
self.y += STEP_Y as u32;
}
KeyCode::Tab => {
self.map_id = (self.map_id + 1) % MAP_DETAILS.len() as u8;
self.facet = map_id_to_facet(self.map_id);
self.x = 0;
self.y = 0;
}... | {
if self.y >= STEP_Y as u32 {
self.y -= STEP_Y as u32;
}
} | conditional_block |
reflect-object-param.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>(T);
fn is_reflect<T:Reflect>() { }
fn a<T>() {
is_reflect::<T>(); //~ ERROR not implemented
}
fn ok_a<T: Reflect>() {
is_reflect::<T>(); // OK
}
fn b<T>() {
is_reflect::<Box<Get<T>>>(); //~ ERROR not implemented
}
fn ok_b<T: Reflect>() {
is_reflect::<Box<Get<T>>>(); // OK
}
fn c<T>() {
is_... | Struct | identifier_name |
reflect-object-param.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 c<T>() {
is_reflect::<Box<Get<Struct<T>>>>(); //~ ERROR not implemented
}
fn main() {
is_reflect::<Box<Get<Struct<()>>>>(); // OK
} | }
| random_line_split |
reflect-object-param.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 ok_a<T: Reflect>() {
is_reflect::<T>(); // OK
}
fn b<T>() {
is_reflect::<Box<Get<T>>>(); //~ ERROR not implemented
}
fn ok_b<T: Reflect>() {
is_reflect::<Box<Get<T>>>(); // OK
}
fn c<T>() {
is_reflect::<Box<Get<Struct<T>>>>(); //~ ERROR not implemented
}
fn main() {
is_reflect::<Box<Get<Str... | {
is_reflect::<T>(); //~ ERROR not implemented
} | identifier_body |
random.rs | // The MIT License (MIT)
//
// Copyright (c) 2015 dinowernli
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy... | impl Random for RandomImpl {
fn next_modulo(&mut self, limit: u64) -> u64 {
return self.next() % limit;
}
} | self.generator.gen::<u64>()
}
}
| random_line_split |
random.rs | // The MIT License (MIT)
//
// Copyright (c) 2015 dinowernli
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy... | (&mut self) -> u64 {
self.generator.gen::<u64>()
}
}
impl Random for RandomImpl {
fn next_modulo(&mut self, limit: u64) -> u64 {
return self.next() % limit;
}
}
| next | identifier_name |
random.rs | // The MIT License (MIT)
//
// Copyright (c) 2015 dinowernli
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy... |
}
impl Random for RandomImpl {
fn next_modulo(&mut self, limit: u64) -> u64 {
return self.next() % limit;
}
}
| {
self.generator.gen::<u64>()
} | identifier_body |
namespace.rs | //! Contains namespace manipulation types and functions.
use std::iter::{Map, Rev};
use std::collections::btree_map::{BTreeMap, Entry};
use std::collections::btree_map::Iter as Entries;
use std::collections::HashSet;
use std::slice::Iter;
/// Designates prefix for namespace definitions.
///
/// See [Namespaces in XML... | e {
// No next namespace, exiting
None
}
}
}
}
impl<'a> IntoIterator for &'a NamespaceStack {
type Item = UriMapping<'a>;
type IntoIter = NamespaceStackMappings<'a>;
fn into_iter(self) -> Self::IntoIter {
NamespaceStackMappings {
... | // If there is next namespace, continue from it
self.next()
} els | conditional_block |
namespace.rs | //! Contains namespace manipulation types and functions.
use std::iter::{Map, Rev};
use std::collections::btree_map::{BTreeMap, Entry};
use std::collections::btree_map::Iter as Entries;
use std::collections::HashSet;
use std::slice::Iter;
/// Designates prefix for namespace definitions.
///
/// See [Namespaces in XML... | /// Namespace stack is a sequence of namespaces.
///
/// Namespace stack is used to represent cumulative namespace consisting of
/// combined namespaces from nested elements.
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct NamespaceStack(pub Vec<Namespace>);
impl NamespaceStack {
/// Returns an empty namespace s... | self.0.iter().map(mapper)
}
}
| random_line_split |
namespace.rs | //! Contains namespace manipulation types and functions.
use std::iter::{Map, Rev};
use std::collections::btree_map::{BTreeMap, Entry};
use std::collections::btree_map::Iter as Entries;
use std::collections::HashSet;
use std::slice::Iter;
/// Designates prefix for namespace definitions.
///
/// See [Namespaces in XML... | <P, U>(&mut self, prefix: P, uri: U) -> Option<String>
where P: Into<String>, U: Into<String>
{
self.0.insert(prefix.into(), uri.into())
}
/// Queries the namespace for the given prefix.
///
/// # Parameters
/// * `prefix` --- namespace prefix.
///
/// # Return value
... | force_put | identifier_name |
namespace.rs | //! Contains namespace manipulation types and functions.
use std::iter::{Map, Rev};
use std::collections::btree_map::{BTreeMap, Entry};
use std::collections::btree_map::Iter as Entries;
use std::collections::HashSet;
use std::slice::Iter;
/// Designates prefix for namespace definitions.
///
/// See [Namespaces in XML... | /// Borrows the topmost namespace immutably, leaving the stack intact.
///
/// Panics if the stack is empty.
#[inline]
pub fn peek(&self) -> &Namespace {
self.0.last().unwrap()
}
/// Puts a mapping into the topmost namespace if this stack does not already contain one.
///
/// ... | self.0.last_mut().unwrap()
}
| identifier_body |
issue-15858.rs | // Copyright 2012-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-MI... |
}
struct Foo<B: Bar>(B);
impl<B: Bar> Drop for Foo<B> {
fn drop(&mut self) {
unsafe {
DROP_RAN = true;
}
}
}
fn main() {
{
let _x: Foo<BarImpl> = Foo(BarImpl);
}
unsafe {
assert_eq!(DROP_RAN, true);
}
}
| {} | identifier_body |
issue-15858.rs | // Copyright 2012-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 http://opensource.org/licenses/MIT>, at your
// option. This file... | random_line_split | |
issue-15858.rs | // Copyright 2012-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-MI... | (&mut self) {
unsafe {
DROP_RAN = true;
}
}
}
fn main() {
{
let _x: Foo<BarImpl> = Foo(BarImpl);
}
unsafe {
assert_eq!(DROP_RAN, true);
}
}
| drop | identifier_name |
issue-3668.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 ... | () {}
| main | identifier_name |
issue-3668.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 ... | {} | identifier_body | |
const-adt-align-mismatch.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 ... | {
assert_eq!(FOO, Foo::C);
assert_eq!(mem::size_of::<Foo>(), 12);
assert_eq!(mem::min_align_of::<Foo>(), 4);
} | identifier_body | |
const-adt-align-mismatch.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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accordin... | random_line_split | |
const-adt-align-mismatch.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 ... | () {
assert_eq!(FOO, Foo::C);
assert_eq!(mem::size_of::<Foo>(), 12);
assert_eq!(mem::min_align_of::<Foo>(), 4);
}
| main | identifier_name |
doc.rs | //! This file tests for the `DOC_MARKDOWN` lint.
#![allow(dead_code, incomplete_features)]
#![warn(clippy::doc_markdown)]
#![feature(custom_inner_attributes, generic_const_exprs, const_option)]
#![rustfmt::skip]
/// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
/// Markdown is _weird_. ... | () {
}
/// This tests units. See also #835.
/// kiB MiB GiB TiB PiB EiB
/// kib Mib Gib Tib Pib Eib
/// kB MB GB TB PB EB
/// kb Mb Gb Tb Pb Eb
/// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
/// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
/// 32kB 32MB 32GB 32TB 32PB 32EB
/// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
/// NaN
/// be_sure_we_got_... | test_emphasis | identifier_name |
doc.rs | //! This file tests for the `DOC_MARKDOWN` lint.
#![allow(dead_code, incomplete_features)]
#![warn(clippy::doc_markdown)]
#![feature(custom_inner_attributes, generic_const_exprs, const_option)]
#![rustfmt::skip]
/// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
/// Markdown is _weird_. ... | /// kib Mib Gib Tib Pib Eib
/// kB MB GB TB PB EB
/// kb Mb Gb Tb Pb Eb
/// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
/// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
/// 32kB 32MB 32GB 32TB 32PB 32EB
/// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
/// NaN
/// be_sure_we_got_to_the_end_of_it
fn test_units() {
}
/// This tests allowed identifiers.... | random_line_split | |
doc.rs | //! This file tests for the `DOC_MARKDOWN` lint.
#![allow(dead_code, incomplete_features)]
#![warn(clippy::doc_markdown)]
#![feature(custom_inner_attributes, generic_const_exprs, const_option)]
#![rustfmt::skip]
/// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
/// Markdown is _weird_. ... |
#[cfg_attr(feature = "a", doc = " ```")]
#[cfg_attr(not(feature = "a"), doc = " ```ignore")]
/// fn main() {
/// let s = "localhost:10000".to_string();
/// println!("{}", s);
/// }
/// ```
fn issue_1469() {}
/**
* This is a doc comment that should not be a list
*This would also be an error under a strict c... | {} | identifier_body |
lint-non-camel-case-types.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 ... |
#![forbid(non_camel_case_types)]
#![allow(dead_code)]
struct ONE_TWO_THREE;
//~^ ERROR type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree`
struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo`
bar: isize,
}
enum foo2 { //~ ERROR type `foo2` should have a camel case n... | // option. This file may not be copied, modified, or distributed
// except according to those terms. | random_line_split |
lint-non-camel-case-types.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 ... | {
bar: isize,
}
struct X86_64;
struct X86__64; //~ ERROR type `X86__64` should have a camel case name such as `X86_64`
struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name such as `Abc123`
struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name such as `A1B2C3`
fn main() { }... | foo7 | identifier_name |
zlib.rs | //! An Implementation of RFC 1950
//!
//! Decoding of zlib compressed streams.
//!
//! # Related Links
//! *http://tools.ietf.org/html/rfc1950 - ZLIB Compressed Data Format Specification
use std::old_io;
use std::old_io::IoResult;
use super::hash::Adler32;
use super::deflate::Inflater;
enum ZlibState {
Start,
... |
ZlibState::End => Err(old_io::standard_error(old_io::EndOfFile))
}
}
}
| {
let _ = try!(self.read_header());
self.state = ZlibState::CompressedData;
self.read(buf)
} | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.