Skip to content

Commit e874b2a

Browse files
committed
Removed incorrectly-implemented Deprecated element type.
1 parent e007bea commit e874b2a

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

src/bson.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub enum Bson {
4141
RegExp(String, String),
4242
JavaScriptCode(String),
4343
JavaScriptCodeWithScope(String, Document),
44-
Deprecated,
4544
I32(i32),
4645
I64(i64),
4746
TimeStamp(i64),
@@ -68,7 +67,6 @@ impl Bson {
6867
&Bson::RegExp(..) => ElementType::RegularExpression,
6968
&Bson::JavaScriptCode(..) => ElementType::JavaScriptCode,
7069
&Bson::JavaScriptCodeWithScope(..) => ElementType::JavaScriptCodeWithScope,
71-
&Bson::Deprecated => ElementType::Deprecated,
7270
&Bson::I32(..) => ElementType::Integer32Bit,
7371
&Bson::I64(..) => ElementType::Integer64Bit,
7472
&Bson::TimeStamp(..) => ElementType::TimeStamp,
@@ -108,7 +106,6 @@ impl Bson {
108106

109107
json::Json::Object(obj)
110108
},
111-
&Bson::Deprecated => json::Json::String("deprecated".to_owned()),
112109
&Bson::I32(v) => json::Json::I64(v as i64),
113110
&Bson::I64(v) => json::Json::I64(v),
114111
&Bson::TimeStamp(v) => json::Json::I64(v),

src/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ fn decode_bson<R: Read + ?Sized>(reader: &mut R, tag: u8) -> DecoderResult<Bson>
209209
let scope = try!(decode_document(reader));
210210
Ok(Bson::JavaScriptCodeWithScope(code, scope))
211211
},
212-
Some(Deprecated) => Ok(Bson::Deprecated),
213212
Some(Integer32Bit) => read_i32(reader).map(Bson::I32),
214213
Some(Integer64Bit) => read_i64(reader).map(Bson::I64),
215214
Some(TimeStamp) => read_i64(reader).map(Bson::TimeStamp),
216215
Some(UtcDatetime) => {
217216
let time = try!(read_i64(reader));
218217
Ok(Bson::UtcDatetime(DateTime::from_utc(NaiveDateTime::from_timestamp(time, 0), UTC)))
219218
},
219+
Some(Deprecated) |
220220
Some(Undefined) |
221221
Some(DbPointer) |
222222
Some(MaxKey) |

src/encoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ fn encode_bson<W: Write + ?Sized>(writer: &mut W, key: &str, val: &Bson) -> Enco
163163
writer.write_all(data).map_err(From::from)
164164
},
165165
&Bson::UtcDatetime(ref v) => write_i64(writer, v.timestamp()),
166-
&Bson::Null |
167-
&Bson::Deprecated => Ok(())
166+
&Bson::Null => Ok(())
168167
}
169168
}
170169

0 commit comments

Comments
 (0)