messages
listlengths
2
2
language
stringclasses
8 values
prompt_type
stringclasses
2 values
lint_errors
int64
0
129
⌀
cyclomatic_complexity
int64
0
32
⌀
license
stringclasses
7 values
commit
stringlengths
40
40
repos
stringlengths
5
116k
new_file
stringlengths
4
220
status
stringclasses
6 values
error
stringlengths
26
74
⌀
is_valid_syntax
bool
2 classes
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::path::posix::Path;\nuse std::os::homedir;\n\nstatic MUXED_NAME_STR: &'static str = \"muxed\";\n\n/// Return the users current homedir as a string.\nfn homedir_string() -> String {\n let home_unwrap = homedir().unwrap();\n forma...
rust
edit
1
1
mit
88fb6527735aabe34e3a776fe319ebe50813cdcb
brianp/muxed,brianp/muxed
src/muxed_root.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/*!\nA binding for SDL2_gfx.\n */\n\n#![crate_name=\"sdl2_gfx\"]\n#![crate_type = \"lib\"]\n\n#![feature(libc)]\n\nextern crate libc;\nextern crate sdl2;\nextern crate \"sdl2-sys\" as sys;\n\n// Setup linking for all targets.\n#[link(name=\"S...
rust
edit
null
null
mit
f5206fcd81bd60591d40279c2c7ae3db28260b6f
andelf/rust-sdl2_gfx,Cobrand/rust-sdl2,Rust-SDL2/rust-sdl2,Cobrand/rust-sdl2,Cobrand/rust-sdl2,vadixidav/rust-sdl2,Rust-SDL2/rust-sdl2,Rust-SDL2/rust-sdl2,AngryLawyer/rust-sdl2
src/sdl2_gfx/lib.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(backtrace)]\n\nmod as_error;\nmod context;\nmod exception;\n\npub use crate::as_error::AsError;\npub use crate::context::Context;\npub use crate::exception::{Errors, Exception};\n\n/// Throw an error.\n///\n/// This macro is equiva...
rust
edit
2
0
apache-2.0
27b8f244d1447526ba108135bab3b3e835865f8b
dtolnay/anyhow
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse ::inflector::Inflector;\nuse ::quote::Tokens;\nuse ::syn::Ident;\nuse ::yaml_rust::Yaml;\n\nuse infer::datatype;\nuse infer::StructBoundArgImpl;\n\nfn infer_v3_json(structs_mod: &Ident, schema: &Yaml) -> StructBoundArgImpl {\n let (inf...
rust
edit
0
2
mit
f5cb4ffc2f8d89fc155c78e7f8f277071b11885a
OJFord/tapioca
tapioca-codegen/src/infer/body.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(proc_macro)]\n#![feature(proc_macro_lib)]\n#![recursion_limit = \"128\"]\n\n#[macro_use] extern crate quote;\n\nextern crate proc_macro;\nextern crate syn;\n\nuse proc_macro::TokenStream;\nuse std::str::FromStr;\n\n// Yield mock ge...
rust
edit
0
6
mit
d91ad9b7ac0bdf9ca590129f344236029e6bc740
maghoff/bart,maghoff/bart
libs/stach_derive/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate hyper;\n\nuse std::thread;\n\nuse self::hyper::server;\n\nuse http::dispatcher::Dispatcher;\nuse http::app_manager::AppManager;\n\npub struct Server {\n pub thread: thread::JoinHandle<()>,\n}\n\nimpl Server {\n pub fn creat...
rust
edit
0
2
mit
1f6f22acb4d2f28118c978cf27bce5c094775b44
juanibiapina/zas,juanibiapina/zas,juanibiapina/zas
src/http/server.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate cmake;\r\n\r\nfn add_squirrel_defines(cmake_cfg: &mut cmake::Config) {\r\n\tcmake_cfg.define(\"INSTALL_LIB_DIR\", \".\");\r\n if cfg!(feature = \"use_double\") {\r\n cmake_cfg.define(\"SQUSEDOUBLE\", \"\");\r\n }\r\n...
rust
edit
0
3
mit
029009e1886ad889e485733a76d56770981c526d
devcen13/squirrel
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(os, io)]\nextern crate hyper;\n\nuse std::os;\nuse std::old_io::stdout;\nuse std::old_io::util::copy;\n\nuse hyper::Client;\n\nfn main() {\n let args = os::args();\n match args.len() {\n 2 => (),\n _ => {\n ...
rust
edit
0
5
mit
00e46d7cdaf0e9ac17f1129521e9c780db1e00fe
nickgonzales/hyper,clatour/hyper,erickt/hyper,Keats/hyper,nstoddard/hyper,peterhj/hyper,huonw/hyper,Twey/hyper,golddranks/hyper,sfackler/hyper,hannobraun/hyper,Twey/hyper,markuskobler/hyper,jmmaranan/hyper,yazaddaruvala/hyper,giftcards/hyper,youprofit/hyper,hyperium/hyper,lame-nickname/hyper,fhahn/hyper,rschulman/hyper...
examples/client.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//\n// Mnemosyne: a functional systems programming language.\n// (c) 2015 Hawk Weisman\n//\n// Mnemosyne is released under the MIT License. Please refer to\n// the LICENSE file at the top-level directory of this distribution\n// or at https:/...
rust
edit
2
1
mit
171a0e7e1fa391526e4b25b26b6e51341577f710
hawkw/mnemosyne
core/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(old_io)]\n#![feature(std_misc)]\n#![feature(step_by)]\n\nuse std::old_io::{timer, Timer};\nuse std::time::duration::Duration;\nuse std::sync::mpsc;\n\nfn main() {\n let interval = Duration::milliseconds(1000);\n // Create a t...
rust
edit
3
1
apache-2.0
6b9a79e7bf53e5d89e02288c0b34aa5cbab5d90b
chriskrycho/rust-by-example,rwaldron/rust-by-example,nodakai/rust-by-example,aakloxu/rust-by-example-cn,dieface/rust-by-example,shaleh/rust-by-example,narutosanjiv/rust-by-example,zhjh1209/rust-by-example,rwaldron/rust-by-example,sohan99/rust-by-example,colinvh/rust-by-example,MatejLach/rust-by-example,MatejLach/rust-b...
examples/timers/timers.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse ui::ncurses::*;\nuse ui::{RIGHT_PANEL_WIDTH, CMD_ENTRY_HEIGHT, Position, Size};\nuse ui::window::BorderWindow;\n\npub struct Chat {\n window: BorderWindow,\n}\n\n// glibc will panic if a message containing a C-style format string is en...
rust
edit
1
1
mit
b00121d74f2148e03ffa0bc370dfaad33634ee67
Acizza/twirc
src/bin/ui/panels/chat.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate env_logger;\n\nextern crate gears;\nuse gears::dsl::command::*;\nuse gears::structure::domain::Domain;\n\n#[test]\nfn test_dsl_domain() {\n let _ = env_logger::init();\n\n let mut domain = Domain::default();\n let e_coun...
rust
edit
0
1
mit
ebc9531ce7c411d3950f73f679b5ac01f47145dd
gears-project/gears-core-rust,michiel/xflow-rust,gears-project/gears-core-rust,michiel/xflow-rust,gears-project/gears-core-rust,michiel/xflow-rust
tests/test_dsl.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! The path element.\n\nmod command;\nmod data;\nmod parameters;\n\npub use self::command::Command;\npub use self::data::Data;\npub use self::parameters::Parameters;\n\n/// A number.\npub type Number = f32;\n\n/// A type of positioning.\n#[d...
rust
edit
1
0
mit
959fe40b5f33c4859af441d02c010cb7305cbf91
stainless-steel/svg
src/node/element/path/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate rocksdb;\n\nmod disk_db;\n\npub use self::disk_db::DiskDB;\n\n#[derive(Debug)]\npub struct DBError {\n message: String\n}\n\nimpl DBError {\n fn new(message: String) -> Self {\n Self { message }\n }\n}\n\npub trai...
rust
edit
0
1
apache-2.0
3876c0261aea03af1a2e47bffae05e36b7950d14
sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse
lighthouse/db/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::thread;\nuse std::time::Duration;\n\nfn main() {\n let simulated_user_specified_value = 3;\n let simulated_random_number = 4;\n\n generate_workout(simulated_user_specified_value, simulated_random_number);\n}\n\n\nfn simulate...
rust
edit
0
3
mit
4ec3692af94e514cb5ff23ebdb21fddf184032af
pgrzesik/learning-rust
23_closures/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::spec::{LinkerFlavor, Target, TargetResult, PanicStrategy};\n\npub fn target() -> TargetResult {\n let mut base = super::windows_msvc_base::opts();\n base.max_atomic_width = Some(64);\n base.has_elf_tls = true;\n\n // FI...
rust
edit
0
1
apache-2.0
01d01ce3ca9727cf647292eb3d9300d05c30a710
graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust
src/librustc_target/spec/aarch64_pc_windows_msvc.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse num::Complex;\n\npub fn butterfly_2(input: &[Complex<f32>],\n input_stride: usize,\n output: &mut [Complex<f32>],\n output_stride: usize,\n twiddles: &[Complex<f32>],\n ...
rust
edit
null
null
apache-2.0
8854ea2b937319740cccb5f0d551a886d99250f0
ejmahler/RustFFT,ejmahler/RustFFT
src/hardcoded_butterflies.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse object_id::ObjectId;\nuse tag::Tag;\nuse branch::Branch;\nuse reference::Reference;\nuse pack_index::PackIndex;\n\npub struct Repository {\n pub path: String,\n pub wc_path: String,\n pub tags: Vec<Tag>,\n pub branches: Vec<Br...
rust
edit
0
1
mit
33832a318543d94a6619556b59f8ba9e7faf0c89
kaisellgren/rust_git
src/repository.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright (c) The Libra Core Contributors\n// SPDX-License-Identifier: Apache-2.0\n\n#![forbid(unsafe_code)]\n\nmod crypto_kv_storage;\nmod crypto_storage;\nmod error;\nmod github;\nmod in_memory;\nmod kv_storage;\nmod namespaced_storage;\...
rust
edit
1
3
apache-2.0
f3a4b0a78f9aea9f0d71e63b9810912396ea15ad
libra/libra,aptos-labs/aptos-core,libra/libra,libra/libra,libra/libra,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core
secure/storage/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![no_main]\n\nuse arbitrary::Arbitrary;\nuse libfuzzer_sys::fuzz_target;\n\n#[derive(Arbitrary, Debug)]\nenum FloatInput {\n F32(f32),\n F64(f64),\n}\n\n#[derive(Arbitrary, Debug)]\nstruct Inputs {\n inputs: Vec<(FloatInput, bool)>,...
rust
edit
0
0
apache-2.0
3702a9f809f46923623e30b47fca11ecf254c99a
dtolnay/ryu
fuzz/fuzz_targets/fuzz_ryu.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse bytes::BufMut;\nuse ruma_api::{\n error::{FromHttpResponseError, IntoHttpError, MatrixError},\n ruma_api, IncomingResponse, OutgoingResponse,\n};\nuse ruma_serde::Outgoing;\n\nruma_api! {\n metadata: {\n description: \"Doe...
rust
edit
0
1
mit
9000567a70a1dfafc1df01404fd76341cdd2cba7
ruma/ruma
crates/ruma-api/tests/ui/05-request-only.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::context::parse_lint_and_tool_name;\nuse rustc_span::{with_default_session_globals, Symbol};\n\n#[test]\nfn parse_lint_no_tool() {\n with_default_session_globals(|| assert_eq!(parse_lint_and_tool_name(\"foo\"), (None, \"foo\")));...
rust
edit
0
2
apache-2.0
d891c8cd544e7f01dba2163cd1016ddf90dfedaf
aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust
compiler/rustc_lint/src/tests.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//!Request handlers.\n\nuse context::Context;\nuse response::Response;\n\n///A trait for request handlers.\npub trait Handler: Send + Sync + 'static {\n ///Handle a request from the client. Panicking within this method is\n ///discourag...
rust
edit
0
2
mit
6315a2e2ace63ecd7f06e7fe0166bfcc1804e4e1
kvikas/rustful,kvikas/rustful
src/handler.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::fmt;\nuse std::error::Error;\nuse super::{\n Ix,\n};\n\n/// An error that can be produced by `.into_shape()`\n#[derive(Clone, Debug)]\npub enum ShapeError {\n /// incompatible shapes in reshape, (from, to)\n IncompatibleShap...
rust
edit
1
2
apache-2.0
7fc352b79e43bd7370e02850627b332c4548f664
SuperFluffy/rust-ndarray,SuperFluffy/rust-ndarray,Pireax/rust-ndarray,Pireax/rust-ndarray
src/shape_error.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse objectclass::ObjectClass;\nuse server::{Id, Entry, Result};\n\npub trait Transaction<D> {\n fn commit(self) -> Result<()>;\n\n // TODO: these are the guts of LmdbAdapter leaking out. They should get moved elsewhere\n fn get(&self...
rust
edit
0
0
apache-2.0
d8c53ace6236ce95b8c357a2a4a56bf23f89e565
cryptosphere/ithos
src/adapter.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse super::{DataStore, DataStoreError};\nuse std::collections::HashMap;\n\npub type HashMapStore = HashMap<String,String>;\n\n/// Implement the DataStore methods for HashMap\nimpl DataStore for HashMapStore {\n\n fn store(&mut self, key: &...
rust
edit
0
1
apache-2.0
b813b76983308fa7897e51a2d5359cc13500030e
coredump-ch/spaceapi
spaceapi_server/src/datastore/hash_map_store.rs
rejected_duplicate
Near-duplicate of sample 120884
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub trait Summarizable {\n fn summary(&self) -> String;\n}\n\n#[cfg(test)]\nmod tests {\n #[test]\n fn it_works() {\n }\n}\n\n```\n\nApply this change: Add struct NewsArticle and implement Summarizable trait for it" }, { "...
rust
edit
0
1
mit
c6512a5d81c7607e2cab37199cde898119ec898f
pgrzesik/learning-rust
traits/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate chrono;\nextern crate clap;\nextern crate hostname;\n#[macro_use]\nextern crate slog;\nextern crate slog_term;\nextern crate slog_async;\n\nmod command_line_arguments;\nmod context;\nmod datetime;\nmod execution_timer;\nmod qork;...
rust
edit
1
1
mit
66edc1451f61534495d9f48475cec950f3838c80
PhilipDaniels/qork,PhilipDaniels/qork,PhilipDaniels/qork
src/rust/qork/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//...
rust
edit
0
1
apache-2.0
8475a4b0c6adce70940617ea5bbb5b691d50d975
aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust
src/test/compile-fail/custom_attribute.rs
rejected_duplicate
Near-duplicate of sample 120676
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate tempfile;\nuse std::io::{Read, Seek, SeekFrom, Write};\nuse std::fs;\n\n#[test]\nfn test_basic() {\n let mut tmpfile = tempfile::tempfile().unwrap();\n write!(tmpfile, \"abcde\").unwrap();\n tmpfile.seek(SeekFrom::Start(...
rust
edit
0
6
apache-2.0
2b8e3e8d8798002f3db24969610feebf5eb2b0a8
Stebalien/tempfile
tests/tempfile.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers\n//\n// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.\n// and the party accessing this file (\"Licensee\") apply to Licensee's use of\n// the Software...
rust
edit
7
1
apache-2.0
8773f69b690016d1c0eb3c4aa081a3ae61102191
rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat
src/fs.rs
rejected_lint
Too many lint violations: 7
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nconst NEGATIVE_A: bool = (-10i32).is_negative();\nconst NEGATIVE_B: bool = 10i32.is_negative();\nconst POSITIVE_A: bool= (-10i32).is_positive();\nconst POSITIVE_B: bool= 10i32.is_positive();\n\nfn main() {\n assert!(NEGATIVE_A);\n asser...
rust
edit
1
1
apache-2.0
f6611db1d59bbf5fb7d5cfbcccc629b6916d06a3
graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust
src/test/run-pass/const-int-sign.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Traits for abstracting away frame allocation and deallocation.\n\nuse crate::structures::paging::{PageSize, PhysFrame};\n\n/// A trait for types that can allocate a frame of memory.\n///\n/// This trait is unsafe to implement because the ...
rust
edit
0
0
mit
1d40fb279647835afa9f26e7c268d22b0b908fa9
phil-opp/rust-x86_64
src/structures/paging/frame_alloc.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//...
rust
edit
1
1
apache-2.0
928bb2be8fee3600db086cfa94775ac9110937e2
ktossell/rust,reem/rust,philyoon/rust,jroesch/rust,aepsil0n/rust,hauleth/rust,pshc/rust,hauleth/rust,ktossell/rust,ebfull/rust,mahkoh/rust,ejjeong/rust,TheNeikos/rust,TheNeikos/rust,reem/rust,mihneadb/rust,bombless/rust,untitaker/rust,kwantam/rust,dwillmer/rust,defuz/rust,XMPPwocky/rust,mdinger/rust,richo/rust,nwin/rus...
src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 Michael Yang. All rights reserved.\n// Use of this source code is governed by a MIT-style\n// license that can be found in the LICENSE file.\n\nuse num::complex::Complex;\n\npub trait Default {\n fn one() -> Self;\n fn...
rust
edit
0
3
mit
b6334d444183a20f32d15d8925f4045b31aeaecb
mikkyang/rust-blas
src/default.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub fn set_or_check<T>(maybe: &mut Option<T>, value: T)\nwhere\n T: std::fmt::Debug + PartialEq\n{\n let previous = maybe.replace(value);\n\n assert!(&previous == maybe, \"Expected {:?} and {:?} to be equal\", &maybe, &previous);\n}\...
rust
edit
0
3
apache-2.0
558c6f84d72824f5174e98842e76edd89c142c36
RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline
utils/search-export/src/utils.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse math::{Point, Vector};\n\n#[derive(Copy, Clone)]\npub struct Ray {\n pub origin: Point,\n pub direction: Vector,\n}\n\nimpl Ray {\n pub fn evaluate(&self, distance: f32) -> Point {\n self.origin + self.direction * distance...
rust
edit
2
1
mit
8f3347b76d11141e8fb5e1223ce78b880b8b69ba
ijks/crabtrace
src/ray.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(zero_one, box_syntax)]\n\nextern crate asexp;\n\npub mod num_expr;\npub mod cond;\n\nuse std::fmt::Debug;\nuse std::cmp::{PartialEq, PartialOrd};\n\n#[derive(Debug, Eq, PartialEq)]\npub enum ExpressionError {\n /// In case of di...
rust
edit
1
0
mit
cc4d99492e45ae95247187f8b3c5a6e867f31e76
mneumann/expression-rs
src/lib.rs
rejected_duplicate
Near-duplicate of sample 120090
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse random::Random;\nuse types::Reward;\n\n/// Model struct for an agent which can interact with an environment.\npub struct Agent {\n age: i32,\n total_reward: Reward,\n num_actions: i16,\n random: Box<Random>,\n}\n\nimpl Agent {\n pub ...
rust
edit
2
1
mit
ce4ecda0e3045dc40dc4d94fa624365e095b9bc9
dinowernli/marvin
src/agent.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate nom_lua53;\n\nuse nom_lua53::{parse_all, ParseResult, Statement};\n\nmod expression;\nmod types;\n\n#[derive(PartialEq,Eq,Debug)]\npub enum LuaError {\n TypeError(String),\n IndexError(String),\n ArithmeticError(...
rust
edit
1
3
mit
0877634abe71a8dfe9772c053d201331dbb3fd32
laarmen/SeO2
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copied from rustc. isatty crate did not work as expected\n#[cfg(unix)]\npub fn stderr_isatty() -> bool {\n isatty(libc::STDERR_FILENO)\n}\n\n// FIXME: Unfortunately this doesn't detect msys terminals so rustup\n// is always colorless th...
rust
edit
0
2
apache-2.0
557e2df3e4d276a42b8e8860bd28f85986ce6090
rust-lang/rustup,nodakai/rustup.rs,rust-lang/rustup,rust-lang/rustup,nodakai/rustup.rs,nodakai/rustup.rs,rust-lang/rustup,nodakai/rustup.rs,nodakai/rustup.rs,rust-lang/rustup
src/utils/tty.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse Printer;\nuse vec::Vec2;\nuse view::{View, ViewWrapper};\n\n/// Draws a border around a wrapped view.\npub struct Panel<V: View> {\n view: V,\n}\n\nimpl<V: View> Panel<V> {\n /// Creates a new panel around the given view.\n pub f...
rust
edit
2
1
mit
ab1f4a2ba6ec4c34e82f84760391ff8603998f33
Gyscos/Cursive
src/views/panel.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! SBD message storage.\n//!\n//! We can store messages in one of several backends, provided as submodules here. Storages\n//! implement the `Storage` trait.\n\nmod filesystem;\nmod memory;\n\npub use self::filesystem::Storage as FilesystemS...
rust
edit
2
0
apache-2.0
4290403cd32539b1b8f8bc7727fbda56f7499f6d
gadomski/sbd-rs
src/storage/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2018 Developers of the Rand project.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or https://opensource.org/license...
rust
edit
0
2
apache-2.0
d7a0d580d450e1591b95c629043c7c13c383cc76
rust-random/getrandom
src/error_impls.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n\n#[cfg(test)]\nmod test {\n #[test]\n fn validate_http_version() {\n unimplemented!()\n }\n}\n\n```\n\nApply this change: Add unit tests for checking HTTP version" }, { "role": "assistant", "content": "extern crat...
rust
edit
0
1
mit
9c2059db072b2436e30086e5686e4eb611df83c0
derniercri/snatch
tests/http_version_test.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate littletest;\n\nuse littletest::{Runnable, TestResult, TestRunner};\n\nstruct TestCase {\n result: TestResult\n}\n\nimpl TestCase {\n fn new(result: TestResult) -> TestCase {\n TestCase {\n result: result\n...
rust
edit
0
1
mit
bf880ec2280bda1b0a23f54fc251b9acc4995e1f
justinlatimer/littletest
tests/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::collections::HashMap;\nuse node;\n\npub type Index = usize;\n\npub struct Edge {\n pub identifier: String,\n pub target: node::Index,\n pub attributes: Option<HashMap<String, String>>,\n pub next_outgoing_edge: Option<Ind...
rust
edit
1
2
mit
e6a8f2ce3a6ce3f46b59422f5c942a21d90bd56e
charlieegan3/graph_match
src/edge.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate gluon;\n\nuse gluon::{new_vm, Compiler};\n\nfn main() {\n let vm = new_vm();\n\n let _ = Compiler::new().run_expr::<&str>(&vm, \"\", r#\" \"test\" \"#);\n //~^ mismatched types [E0308]\n}\n\n```\n\nApply this change: Fix...
rust
edit
0
1
mit
85cd78175683f00f00c403425e0c049aa3007d70
gluon-lang/gluon,gluon-lang/gluon,Marwes/embed_lang,Marwes/embed_lang
tests/compile-fail/run_expr_str_ref.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate rand;\nuse std::cmp::Ordering;\nuse rand::Rng;\n\nfn main() {\n let width: usize = 10; // FUTURE: can get this value from user\n let height: usize = 10; // FUTURE: can get this value from user\n let mut board: Vec...
rust
edit
0
5
bsd-3-clause
e780ece0b3424b00eb7e2c18bdd1093c4930b09f
nathanbw/game-of-life
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(flt2dec)]\n#![feature(test)]\n\nextern crate test;\n\nmod any;\nmod ascii;\nmod char;\nmod fmt;\nmod hash;\nmod iter;\nmod num;\nmod ops;\nmod pattern;\nmod slice;\n\n```\n\nApply this change: Disable core benches on wasm (benches ...
rust
edit
1
0
apache-2.0
5a9ff052b4879e4ef6748c2f85563a7db0548c0b
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust
src/libcore/benches/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! A probability-theory toolbox.\n//!\n//! ## Example\n//!\n//! ```\n//! use probability::prelude::*;\n//!\n//! let mut source = random::default();\n//! let uniform = Uniform::new(0.0, 1.0);\n//! let samples = Independent(&uniform, &mut sour...
rust
edit
2
0
mit
b6a39b31b87141c4719d43079f494d3e58f72f61
achanda/probability,runarberg/probability
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate error_chain;\n#[macro_use]\nextern crate serde_derive;\nextern crate serde_yaml;\n\nmod config;\n\nuse self::config::{Config, Error, ErrorKind};\nuse std::path::Path;\nuse std::io::{stderr, Write};\nuse std::env::ho...
rust
edit
0
2
mit
f1ef88a799c5e1940bd5d613e3a686752ad33a0b
brennie/metabrowser
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse libc::system;\nuse std::ffi::CString;\n\nstatic TMUX_NAME: &'static str = \"tmux\";\nstatic NEW_SESSION: &'static str = \"new -s\";\n\npub fn open(session_name: String) {\n let system_call = CString::new(format!(\"{} {} {}\", TMUX_NAME...
rust
edit
2
1
mit
ac10bb43e5e6d3b5dbb54299dd4810b1b94b017f
brianp/muxed,brianp/muxed
src/tmux/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate futures;\nextern crate tokio_inotify;\nextern crate tokio_core;\n\nuse std::path::Path;\nuse std::env;\n\nuse futures::stream::Stream;\nuse tokio_inotify::AsyncINotify;\nuse tokio_core::reactor::Core;\n\nfn home_dir() -> String {...
rust
edit
0
4
mit
ee91fd8f6d92e09bb1463e0f62fa59be84940fc9
dermesser/tokio-inotify
example/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// build-pass (FIXME(62277): could be check-pass?)\n// compiler-flags: -g\n\npub struct Dst {\n pub a: (),\n pub b: (),\n pub data: [u8],\n}\n\npub unsafe fn borrow(bytes: &[u8]) -> &Dst {\n let dst: &Dst = std::mem::transmute((by...
rust
edit
2
1
apache-2.0
242702965b759ad92f49c024d6cf2411af409bd7
graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust
src/test/ui/issues/issue-23477.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// ignore-tidy-linelength\n\n#![crate_name = \"foo\"]\n\n//! This is the \"start\" of the 'document'! How'd you know that \"it's\" the start?\n//!\n//! # Header with \"smart punct'\"\n//!\n//! [link with \"smart punct'\" -- yessiree!][]\n//!\...
rust
edit
0
0
apache-2.0
0a3452110c605655e7ab949c0904f053ab0cc71b
graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust
src/test/rustdoc/smart-punct.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// run-pass\n\nfn main () {\n let n = (1, (2, 3)).1.1;\n assert_eq!(n, 3);\n}\n\n```\n\nApply this change: Test even deeper nested indexing" }, { "role": "assistant", "content": "// run-pass\n\nfn main () {\n let n = (1, ...
rust
edit
0
1
apache-2.0
0432f63acf5b08c23ad206a87e3ad4a2a171cf7f
graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust
src/test/ui/tuple/nested-index.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// compile-flags: -O\n// min-llvm-version: 11.0\n\n#![crate_type = \"lib\"]\n\n// CHECK-LABEL: @trim_in_place\n#[no_mangle]\npub fn trim_in_place(a: &mut &[u8]) {\n while a.first() == Some(&42) {\n // CHECK-NOT: slice_index_order_fa...
rust
edit
0
2
apache-2.0
046556e94c641d2615bc9f7b11fba7a8573277ce
graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust
src/test/codegen/issue-27130.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//\n// SOS: the Stupid Operating System\n// by Hawk Weisman (<EMAIL>)\n//\n// Copyright (c) 2015 Hawk Weisman\n// Released under the terms of the MIT license. See `LICENSE` in the root\n// directory of this repository for more informatio...
rust
edit
0
1
apache-2.0
5ece1dc03d65cb254c33325cf87ceba451676e24
hawkw/sos-kernel,rachlmac/sos-kernel,rachlmac/sos-kernel,rachlmac/sos-kernel,hawkw/sos-kernel,hawkw/sos-kernel
src/util.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate criterion;\n\nuse criterion::Criterion;\n\nfn fib(n: u64) -> u64 {\n let mut a = 0u64;\n let mut b = 1u64;\n let mut c = 0u64;\n\n if n == 0 {\n return 0\n }\n\n for _ in 0..(n+1) {\n ...
rust
edit
0
2
apache-2.0
299f5b58f0a7f18919150fa63d01fdab448ab8d8
mindriot101/rust-fitsio,mindriot101/rust-fitsio,mindriot101/rust-fitsio,mindriot101/rust-cfitsio,mindriot101/rust-fitsio,mindriot101/rust-cfitsio,mindriot101/rust-fitsio
fitsio/benches/benchmarks.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate askama;\n\nuse askama::Template;\n\n#[derive(Template)]\n#[template(path = \"for.html\")]\nstruct ForTemplate<'a> {\n strings: Vec<&'a str>,\n}\n\n#[test]\nfn test_for() {\n let s = ForTemplate {\n stri...
rust
edit
0
1
apache-2.0
4c8a5b51046c0f58f5a4c805794735bcd778eb8d
djc/askama,djc/askama,djc/askama
testing/tests/loops.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright lowRISC contributors.\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n\nuse crate::transport::ti50emulator::Ti50Emulator;\nuse crate::transport::Transport;\nus...
rust
edit
0
2
apache-2.0
7007f1c4dedf38b94820ab234c938367dcab5154
lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan
sw/host/opentitanlib/src/backend/ti50emulator.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(core)]\n\n// This code is editable and runnable!\nfn main() {\n // A simple integer calculator:\n // `+` or `-` means add or subtract by 1\n // `*` or `/` means multiply or divide by 2\n\n let program = \"+ + * - /\";\n...
rust
edit
0
3
apache-2.0
bb4c538db3c6809eaac3ede6680fb380d57503c9
jFransham/rust-www,ituxbag/rust-www,ituxbag/rust-www,azerupi/rust-www,ituxbag/rust-www,starsep/rust-www,starsep/rust-www,azerupi/rust-www,starsep/rust-www,AndrewBrinker/rust-www,AndrewBrinker/rust-www,AndrewBrinker/rust-www,jFransham/rust-www,starsep/rust-www,AndrewBrinker/rust-www,starsep/rust-www,jFransham/rust-www,A...
_includes/example.rs
rejected_duplicate
Near-duplicate of sample 119766
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse super::{completer::IonCompleter, InteractiveBinary};\nuse std::io::ErrorKind;\n\npub fn readln(binary: &InteractiveBinary) -> Option<String> {\n let shell = binary.shell.borrow();\n let mut completer = IonCompleter::new(&shell);\n ...
rust
edit
0
8
mit
621f077e5ed4f85d7a6ccc3c9300a396462357d4
redox-os/ion,redox-os/ion,redox-os/ion
src/binary/readln.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// http://rosettacode.org/wiki/Strip_comments_from_a_string\n\nfn strip_comments(str: &str) -> &str {\n let markers = ['#', ';'];\n str.find(markers.as_slice()).map_or(str, |i| str.slice_to(i)).trim_right()\n}\n\n#[test]\nfn test_strip_...
rust
edit
0
2
unlicense
f6431acb1a1a6d652a1625efba40633f99d56ab9
magum/rust-rosetta,crespyl/rust-rosetta,crr0004/rust-rosetta,pfalabella/rust-rosetta,JIghtuse/rust-rosetta,ZoomRmc/rust-rosetta,Hoverbear/rust-rosetta,ghotiphud/rust-rosetta,sakeven/rust-rosetta,magum/rust-rosetta
src/strip_comments_from_a_string.rs
rejected_duplicate
Near-duplicate of sample 120707
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2012 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//...
rust
edit
0
1
apache-2.0
811d88024fab449d00682fd6fd0179c153f94fa0
sarojaba/rust-doc-korean,P1start/rust,mihneadb/rust,quornian/rust,kmcallister/rust,AerialX/rust,kwantam/rust,mihneadb/rust,mitsuhiko/rust,jbclements/rust,zachwick/rust,philyoon/rust,LeoTestard/rust,LeoTestard/rust,aidancully/rust,miniupnp/rust,kmcallister/rust,servo/rust,fabricedesre/rust,servo/rust,aidancully/rust,quo...
src/test/run-pass/cfgs-on-items.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//!\n//! https://tools.ietf.org/html/rfc5161\n//!\n//! The IMAP ENABLE Extension\n//!\n\n// rustfmt doesn't do a very good job on nom parser invocations.\n#![cfg_attr(rustfmt, rustfmt_skip)]\n\nuse crate::types::*;\nuse crate::parser::core::a...
rust
edit
0
2
apache-2.0
c5d1f742d8af01285033f3e12cad87d9d27a5572
djc/tokio-imap
imap-proto/src/parser/rfc5161.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate num;\nextern crate oxcable;\n\npub mod adsr;\npub mod delay;\npub mod dynamics;\npub mod reverb;\npub mod tremolo;\n\n```\n\nApply this change: Write top level module docs." }, { "role": "assistant", "content": "//! B...
rust
edit
1
0
apache-2.0
4c0623e8e41bc7e8a37333a93a648c005945c1db
oxcable/basic-devices,oxcable/basic-devices
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio\n//! codec, written in Rust.\n\n#[macro_use]\nextern crate nom;\n\n#[macro_use]\nmod utility;\npub mod metadata;\npub mod frame;\npub mod subframe;\npub mod stream;\n...
rust
edit
1
0
bsd-3-clause
c2e24c2d31bb033f5dab3bfd2b48fef067c2e398
sourrust/flac
src/lib.rs
rejected_duplicate
Near-duplicate of sample 120008
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 Dmitry \"Divius\" Tantsur <<EMAIL>>\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licen...
rust
edit
4
0
apache-2.0
06e80ca06d807d445b424513406d10de45def280
divius/rust-dht,cheme/rust-dht,cheme/rust-dht,divius/rust-dht
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE o...
rust
edit
2
0
apache-2.0
c9972c4b163367fa02e74e20854683e14fb336d7
rust-lang/rustc-serialize,SimonSapin/rustc-serialize,shepmaster/rustc-serialize,DenisKolodin/rustc-serialize,indefini/rustc-serialize,rust-lang-deprecated/rustc-serialize,ajroetker/rustc-serialize,gbersac/rustc-serialize,rust-lang-nursery/rustc-serialize
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2016, The Gtk-rs Project Developers.\n// See the COPYRIGHT file at the top-level directory of this distribution.\n// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>\n\nuse glib::transl...
rust
edit
0
1
mit
f0d043ee0a5d6544172f2159388af1b26f14ccb3
rust-gnome/gdk,rust-gnome/gdk
src/event_scroll.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nmod macros;\n\nuse std::str::FromStr;\n\nuse proc_macro2::TokenStream;\nuse syn::{Expr, ExprRange};\n\n#[test]\nfn test_expr_parse() {\n let code = \"..100u32\";\n let tt = TokenStream::from_str(code).unwrap();\n let ex...
rust
edit
2
1
apache-2.0
ee9747cb0f5e600e9013755ded962560528e6e38
dtolnay/syn
tests/test_expr.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Used to specify checks that shouldn't fail (but might in unsafe)\nmacro_rules! dbg_gl_error {\n ($($pat:pat => $msg:expr),*) => {\n if cfg!(debug_assertions) {\n let err = $crate::Context::get_error();\n mat...
rust
edit
3
3
apache-2.0
fc62c787b62d165bf4a57b84c69b3e87c7e1983d
kylewlacy/glitter,kylewlacy/glitter
src/macros.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse clap::{App, ArgMatches};\n\nuse prelude::*;\nuse config::Config;\nuse utils::ArgExt;\n\n\npub fn make_app<'a, 'b: 'a>(app: App<'a, 'b>) -> App<'a, 'b> {\n app.about(\"uploads react-native projects from within a gradle build step\")\n ...
rust
edit
0
1
bsd-3-clause
3b5a8c8efb165b1a657f6d11025ec5cf787b9956
getsentry/sentry-cli,getsentry/sentry-cli,getsentry/sentry-cli
src/commands/react_native_gradle.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2020 Google LLC\n//\n// Use of this source code is governed by an MIT-style license that can be found\n// in the LICENSE file or at https://opensource.org/licenses/MIT.\n\nuse fleetspeak::client::Packet;\n\nfn main() -> std::io::...
rust
edit
0
4
mit
e25a304e2240a7ba5df57cecbafdb4a6836d7943
google/fleetspeak-rs
examples/hello.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[cfg(feature = \"inline_asm\")]\nfn main() {}\n\n#[cfg(all(not(feature = \"inline_asm\"), not(feature = \"stable\")))]\nfn check_inline_asm() {\n compile_error!(\"Neither feature \\\"stable\\\" nor \\\"inline_asm\\\" was set!\");\n}\n\n#[...
rust
edit
0
4
mit
4aa3ac88645904d15a01d4b4c5f7eb9fa202367f
phil-opp/rust-x86_64
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n\n#![feature(proc_macro)]\n\nexter...
rust
edit
1
2
mit
a2fcaf1a526f1b0dd8c00adf60767506df746da4
nrc/rustc-perf,nrc/rustc-perf,nrc/rustc-perf
collector/benchmarks/script-servo/components/dom_struct/lib.rs
rejected_duplicate
Near-duplicate of sample 120996
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[test]\nfn from() {\n use core::convert::TryFrom;\n use core::num::TryFromIntError;\n\n // From\n const FROM: i64 = i64::from(1i32);\n assert_eq!(FROM, 1i64);\n\n // Upper bounded\n const U8_FROM_U16: Result<u8, TryFromI...
rust
edit
0
1
apache-2.0
c8bf5ed628c5007bd7c88a2265698d3117cbdc72
graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust
library/core/tests/num/const_from.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub struct Handler;\n\nimpl Handler {\n pub unsafe fn new() -> Handler {\n Handler\n }\n}\n\n#[cfg_attr(test, allow(dead_code))]\npub unsafe fn init() {}\n\npub unsafe fn cleanup() {}\n\n```\n\nApply this change: Remove unnecessa...
rust
edit
0
1
apache-2.0
53aa5a1113619dda8e1e1b5ebda920ef1adb2395
aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust
src/libstd/sys/sgx/stack_overflow.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse ::serde_json;\nuse ::zip;\nuse std::collections::HashMap;\n\n#[derive(Serialize, Debug)]\nstruct MultiArchiveJsonWriter<'a> {\n archives: HashMap<&'a str, &'a ZipArchiveJsonWriter<'a>>,\n}\n\n#[derive(Serialize, Debug)]\nstruct ZipArch...
rust
edit
0
1
mit
04d1dd82ca861f4ab83b9c9439ea972c433cf0fe
rowedonalde/zip-info
src/json_writer.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Zinc, the bare metal stack for rust.\n// Copyright 2014 Vladimir \"farcaller\" Pouzanov <<EMAIL>>\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License...
rust
edit
0
0
apache-2.0
dc304d436802e0a2685daeb33827ac0959da6fbe
posborne/zinc,posborne/zinc,aethaniel/zinc,hackndev/zinc,ryankurte/zinc,tempbottle/zinc,hackndev/zinc,ryankurte/zinc,dirvine/zinc,flxo/zinc,dirvine/zinc,ntwyman/zinc,richo/zinc,0xc0170/zinc,aethaniel/zinc,phil-opp/zinc,troplin/zinc,mcoffin/zinc,troplin/zinc,gapry/zinc,richo/zinc,hackndev/zinc,phil-opp/zinc,posborne/zin...
src/hal/pin.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Encoding of portable pixmap Images\n\npub use self::encoder::PPMEncoder as PPMEncoder;\npub use self::decoder::PPMDecoder as PPMDecoder;\n\nmod encoder;\nmod decoder;\n\n```\n\nApply this change: Add a roundtrip test to PPM" }, { ...
rust
edit
1
4
mit
0dc131d7f138747b99b8a3f0185f343b1647533a
PistonDevelopers/image,mbrubeck/image,nwin/rust-image,PistonDevelopers/image
src/ppm/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::{Message, RosMsg};\nuse std::io;\n\n#[derive(Clone, Debug, Default, PartialEq)]\npub struct RawMessage(pub Vec<u8>);\n\n#[derive(Clone, Debug, PartialEq)]\npub struct RawMessageDescription {\n pub msg_definition: String,\n pu...
rust
edit
0
2
mit
e7f06b48410c8f78e21e8cd54ebdfe9130f058b6
adnanademovic/rosrust
rosrust/src/raw_message.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate time;\nuse time::precise_time_ns;\n\nfn time_ns() -> u64 {\n precise_time_ns()\n}\n\n#[macro_export]\nmacro_rules! stack {\n ($name:expr, $work:expr) => {\n {\n let work = {|| $work};\n println!...
rust
edit
0
1
mit
6de660b2956e9c7bad355ed5e5a379b2308b7528
daniel-vainsencher/stackman
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub extern crate fiz_math as math;\n\nmod test{\n #[allow(unused_imports)]\n use super::math;\n\n #[test]\n fn crate_names() {\n assert!(math::equal(1.0, 1.0));\n }\n}\n\n```\n\nApply this change: Update to most recent math API change...
rust
edit
0
1
bsd-3-clause
08c84d3e92636445f8ddc6f507d0d3020935ecf2
fiz3d/fiz
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate orbtk;\n\nuse orbtk::*;\n\nfn main() {\n let mut window = Window::new(Rect::new(0, 0, 400, 400), \"OrbTK\");\n\n window.widgets.push(\n Label::new(Rect::new(20, 20, 80, 16), \"Test Label\")\n .on_click(Box::ne...
rust
edit
0
1
mit
91291798450d439b05e771be0e7fb63802f936d7
redox-os/orbtk
src/example.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::iter::FromIterator;\nuse std::iter::repeat;\n\nuse set1::challenge2::fixed_xor;\nuse set1::utils::bytes_to_hex;\n\nfn repeating_xor(text: &[u8], key: &[u8]) -> String {\n bytes_to_hex(&fixed_xor(text,\n ...
rust
edit
0
1
mit
68d5cd65d4d42a625278becf06af0e012cd57303
rkuska/cryptopals-rs
src/set1/challenge5.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE o...
rust
edit
0
1
apache-2.0
9322a38534c9ad4e6c6a048580ffd68e842d1077
aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust
src/test/compile-fail/issue-37131.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![no_main]\n\nuse arbitrary::Arbitrary;\nuse libfuzzer_sys::fuzz_target;\n\n#[derive(Arbitrary, Debug)]\nenum IntegerInput {\n I8(i8),\n U8(u8),\n I16(i16),\n U16(u16),\n I32(i32),\n U32(u32),\n I64(i64),\n U64(u64),\...
rust
edit
0
0
apache-2.0
951c29d200c98b7f11b50e1b82868074edcd9dd3
dtolnay/itoa
fuzz/fuzz_targets/fuzz_itoa.rs
accepted
null
true
[ { "role": "user", "content": "Write rust code for the following: Read ROM file using cli" }, { "role": "assistant", "content": "use std::env;\nuse std::fs;\nuse std::io::Read;\nuse std::path::Path;\n\nfn main() {\n if let Some(rom_file_name) = env::args().nth(1) {\n println!(\"ROM: {}\...
rust
new_file
0
3
mit
27b2a5bba4498027deb09497a51101d864a87ef1
LokiFaun/chip8-rs
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::env;\n\nmod command;\n\nuse command::*;\n\nfn main() {\n let args = env::args().skip(1).collect::<Vec<String>>();\n\n if args.is_empty() {\n print_usage();\n return\n }\n\n match args[0].as_ref() {\n ...
rust
edit
1
3
mit
fcb0113e5619b38314957a378a80f8e144609ac2
ttokutake/kic,ttokutake/kic,ttokutake/kic
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nstruct Philosopher {\n name: String\n}\n\nimpl Philosopher {\n fn new(name: &str) -> Philosopher {\n Philosopher {\n name: name.to_string()\n }\n }\n}\n\nfn main() {\n\n}\n\n```\n\nApply this change: Create 5...
rust
edit
7
1
mit
e2fc2b1057ea3c5aa05b04a505212771c70b4978
juliangrosshauser/dining_philosophers
src/main.rs
rejected_lint
Too many lint violations: 7
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Command line utility for querying and working with Iridium SBD messages.\n\nextern crate docopt;\nextern crate rustc_serialize;\nextern crate sbd;\n\nuse docopt::Docopt;\n\nuse sbd::filesystem::Storage;\n\nconst USAGE: &'static str = \"\n...
rust
edit
0
3
apache-2.0
5e1c23c6393a00cbf9b4346df06f4557c704ea22
gadomski/sbd-rs
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(test)]\n\n// TODO use cfg(bench) to make pub functions not-pub depending on context\n#[cfg(test)]\nmod test {\n extern crate test;\n use bliss_rs::timbral::SpectralDesc;\n use test::Bencher;\n\n #[bench]\n fn bench_s...
rust
edit
0
2
mit
23134fa86ed6578dc136f6897bf87eb83e1ed4f8
Polochon-street/bliss,Polochon-street/bliss,Polochon-street/bliss
bliss-rs/benches/timbral.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate error_chain;\nextern crate reqwest;\nextern crate serde;\n#[macro_use]\nextern crate serde_derive;\nextern crate serde_json as json;\nextern crate toml;\nextern crate url;\n\nmod config;\nmod crates_io;\nmod errors;...
rust
edit
3
0
mit
984182f73d7e7caa6989ce5be9bfa75fe166c432
woxtu/cargo-thank-you-stars
src/main.rs
rejected_duplicate
Near-duplicate of sample 121224
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// Maximum number of channels supported in the FLAC format.\npub const MAX_CHANNELS: usize = 8;\n\n/// Audio frame that contains one sample for each channel.\npub struct Frame {\n /// Information regarding the current audio frame.\n pub he...
rust
edit
0
0
bsd-3-clause
c19c8e45bec5440bd98afe9359e6d4330faa3218
sourrust/flac
src/frame/types.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate getopts;\nuse getopts::{optopt, optflag, OptGroup};\nuse std::os;\n\n\nuse device_info::{DefaultDevice, DefaultInterface, UserDefinedDevice, UserDefinedName, DeviceInfo};\nmod device_info;\n\n\nenum ParseArgsResult {\n HelpReq...
rust
edit
0
5
mit
88e01933c905afd65c263b97d6107e2e0629e3a6
graememcc/netStack,graememcc/netStack
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[derive(Debug)]\npub struct Rectangle {\n length: u32,\n width: u32\n}\n\nimpl Rectangle {\n pub fn can_hold(&self, other: &Rectangle) -> bool {\n self.length > other.length && self.width > other.width\n }\n}\n\n#[cfg(test...
rust
edit
0
2
mit
4d309a29fed6a7fced656952f4eeb83a1d34876c
pgrzesik/learning-rust
testing/src/lib.rs
rejected_duplicate
Near-duplicate of sample 119974
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(plugin)]\n#![plugin(json_macros)]\n\nextern crate time;\nextern crate rand;\nextern crate url;\nextern crate sxd_document;\nextern crate sxd_xpath;\nextern crate rustc_serialize;\nextern crate byteorder;\nextern crate hyper;\nexter...
rust
edit
1
0
mit
dd1fb78af39510d2b6e69c2b449bee9b7c1da7d8
messense/wechat-rs
src/lib.rs
accepted
null
true